Skip to content

feat(template): let Do nothing keep an existing note closed when Open is on - #2280

Draft
chhoumann wants to merge 1 commit into
masterfrom
issue-2279
Draft

chhoumann wants to merge 1 commit into
masterfrom
issue-2279

Conversation

@chhoumann

@chhoumann chhoumann commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Why

The goal is to create a note on every run, such as a daily note made by a startup macro, and open it only on the run that creates it. QuickAdd had no setting for that. With Open on, both Keep existing file actions opened an existing note. With Open off, a new note stayed closed.

Product decision

QuickAdd should support this as a general rule, not a daily-note flag. Open applies to the note a run creates or updates. Keep action applies to a note that already exists. Before this change, Open on + Do nothing behaved exactly like Open on + Open existing file, so one combination was redundant and the useful one was missing. Now each of the four combinations does something different:

Open existing file Do nothing
Open off opens existing only never opens
Open on always opens opens only a new note

This helps any Template choice run by a startup macro, a URI, the CLI, or another macro. It adds no setting and no UI row.

Rejected alternative: an "only open new notes" toggle under Open. It overlaps Keep action and adds a setting for the same need.

What changed

  • Do nothing under Keep existing file never opens the existing note, even with Open on. It is stored as a new mode id, leaveClosed.
  • A keep mode now decides on its own whether a kept note opens. Open decides only for created or updated notes (TemplateChoiceEngine.run).
  • leaveUnchanged (2.33.0, feat(template): add Do nothing to Keep existing file #2245) is retired, not reinterpreted. A stored id with a new meaning would be ambiguous in packages exported by other versions. It maps by behavior. With Open on it becomes doNothing, and with Open off it becomes leaveClosed. Both match the old behavior exactly. The new retireLeaveUnchangedKeepMode migration covers data.json, and normalizeTemplateChoice covers package import.
  • The docs say what Do nothing does and give the startup-macro recipe.

The labels in the choice builder do not change ("Open existing file", "Do nothing"), so this PR has no screenshots. Only the stored value behind Do nothing changes.

Release and migration impact

Verification

  • Native E2E tests/e2e/file-exists-behavior.test.ts passes 37/37. It adds a [FEATURE REQUEST] Open note only if newly created #2279 scenario that runs the choice twice with Open on and Do nothing. The first run creates and opens the note. The second leaves it closed (effect: unchanged). It also adds an E2E check that the migration maps leaveUnchanged by Open.
  • With the engine change reverted, the [FEATURE REQUEST] Open note only if newly created #2279 E2E fails on the second run with expected [ Array(1) ] to deeply equal [], meaning the existing note opened. The unit cell leaveClosed with openFile=true fails the same way. With the normalizer reverted, all 3 mapping tests fail.
  • Live in Obsidian, I seeded a macro with Run on startup that runs this Template choice, then reloaded QuickAdd. Load 1 created Daily 2279.md and opened it. Load 2 left it closed and showed "'Daily 2279' already exists.". dev:errors captured no errors.
  • pnpm run test passed 6991 tests and pnpm run lint passed.

Fixes #2279

Note

Rename leaveUnchanged to leaveClosed so Do nothing can open existing notes with Open on

  • Renames the leaveUnchanged keep mode to leaveClosed in fileExistsPolicy.ts. leaveClosed keeps the reused note closed even when Open is enabled; doNothing opens it.
  • TemplateChoiceEngine.ts now computes one opening decision: it starts from the choice's openFile setting and applies the keep mode's keptFileOpens value only when an existing file is reused.
  • Adds the retireLeaveUnchangedKeepMode migration in migrate.ts, backed by normalization in normalizeTemplateFileExistsBehavior.ts. Legacy leaveUnchanged choices map to doNothing when openFile is true and leaveClosed otherwise.
  • Updates unit and e2e tests plus the TemplateChoice docs.
  • Behavioral Change: choices previously stored with leaveUnchanged change behavior after migration — with Open on they now open the existing note via doNothing; with Open off they keep it closed via leaveClosed. The legacy mode map in legacyFileExistsModeMap no longer recognizes leaveUnchanged, so unmigrated settings with that value will not resolve.

Macroscope summarized 0cce329.

… is on

Open on with Keep existing file > Do nothing now opens a note only on the run
that creates it. The new keep mode is stored as leaveClosed. Choices saved with
2.33's leaveUnchanged move to the mode with the same behavior: doNothing when
Open is on, leaveClosed when it is off. A migration handles data.json and
package import handles exported packages.

Refs #2279
@chhoumann chhoumann linked an issue Nov 10, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0cce329
Status: ✅  Deploy successful!
Preview URL: https://3f70808a.quickadd.pages.dev
Branch Preview URL: https://issue-2279.quickadd.pages.dev

View logs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Open note only if newly created

1 participant