Skip to content

Make undo tracking opt-in#48

Merged
TrystonPerry merged 2 commits into
masterfrom
tdawg/bratislava
Jul 15, 2026
Merged

Make undo tracking opt-in#48
TrystonPerry merged 2 commits into
masterfrom
tdawg/bratislava

Conversation

@TrystonPerry

@TrystonPerry TrystonPerry commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Undo recording now defaults to disabled for document and collection hooks and their shared subscriptions, with explicit resource-level opt-in via undoable: true. Regression tests cover the disabled default and enabled behavior, while documentation and the React tasks example are updated for the new contract. Bumps the package version to 0.1.7. Validation: pnpm test, pnpm typecheck, pnpm build, and the React tasks example build.

Note

Make undo tracking opt-in for useDocument and useCollection hooks

  • Changes the default value of undoable from true to false in useDocument, useCollection, and the underlying shared subscription factories in src/core/shared-subscription.ts and src/react/hooks.ts.
  • Resources must now explicitly pass undoable: true to their hook call to enable undo tracking; individual writes can still skip undo with a per-call undoable: false.
  • Updates the React Tasks example app to opt in where needed and adds tests verifying undo is not recorded by default.
  • Behavioral Change: any existing hook usage that relied on undo being enabled by default will silently stop recording undo actions after this update.
📊 Macroscope summarized 9db06e8. 8 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@TrystonPerry
TrystonPerry merged commit 89422a4 into master Jul 15, 2026
2 checks passed
@TrystonPerry
TrystonPerry deleted the tdawg/bratislava branch July 15, 2026 20:24
*/
function TaskListBody() {
const tasks = useTaskListView(PARAMS)
const tasks = useTaskListView(PARAMS, { readOnly: true })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium src/App.tsx:197

TaskListBody uses useTaskListView(PARAMS, { readOnly: true }) without undoable, so it overwrites the shared collection's undo flag to false after AddTaskForm sets it to true. When the list is empty there are no TaskRow instances to reset the flag, so adding the first task is not recorded in undo history and cannot be undone. Pass undoable: true here as well, or make read-only consumers leave the shared undo setting unchanged.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @examples/react-tasks/src/App.tsx around line 197:

`TaskListBody` uses `useTaskListView(PARAMS, { readOnly: true })` without `undoable`, so it overwrites the shared collection's undo flag to `false` after `AddTaskForm` sets it to `true`. When the list is empty there are no `TaskRow` instances to reset the flag, so adding the first task is not recorded in undo history and cannot be undone. Pass `undoable: true` here as well, or make read-only consumers leave the shared undo setting unchanged.

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.

1 participant