* feat: Make model.save() optimistic with rollback on failure
Apply saved params to the model immediately so MobX observers update
without waiting for the server, and roll the model back to its previous
state when the request fails. New models with a client-generated id are
optimistically added to the store and removed again on failure.
* chore: Apply formatter and test naming convention
* fix: Scope optimistic saves to passed fields and confirmed values
Only fields passed to save() are applied optimistically, and a failure
reverts a field only while it still holds the optimistic value. Change
hooks compare against the last confirmed values so they run when the
server responds. The optimistic store add is removed.
* refactor: Use optimistic save for preferences and field toggles
Add savePreference to User, Team and Document, and pass changed fields to
save() so they revert on failure.
* fix: Only compare incoming fields against confirmed values in change hooks
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix: Run forced document tree fetches that arrive while a fetch is in flight
* fix: Run forced store fetches that arrive while a fetch is in flight
* test
* fix: Show nested shared documents under their shared parent in sidebar
* fix: Select shared roots from ancestor grants, ignore stale cached trees
* Revert ancestor walk in membership list queries
* fix: Revision view does not re-render when late content arrives
Pre-define every MobX-decorated field on model instances so reads made
before the data arrives are tracked.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test: Inherited base-class fields are observable on partial models
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* feat: Persist policies to IndexedDB so abilities survive reload
Adds a StorePersistence layer that caches a store's models in IndexedDB
and hydrates them back at boot as stale data, revalidated by normal API
traffic. Enabled for the policies store, scoped per team, so cached
abilities are available immediately after a reload instead of every
policy needing a forced refetch.
- Persistence hooks in the base Store add/remove/clear methods, since
add() updates existing models in place and map observation would miss
those changes
- Enabled from RootStore construction (team read from localStorage) and
again after auth.info succeeds to cover the first session after login
- Store.clear() wipes the persisted records, covering both logout paths
- deleteAllDatabases() fallback removes the policies database on
browsers without indexedDB.databases()
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XisV6sRdexfnPSiehurKoV
* refactor: Opt stores into persistence via a persistable property
Stores now declare persistence with `persistable = true` and RootStore
sweeps all persistable stores, deriving each database name from the
store's apiEndpoint, instead of RootStore hard-coding the policies
store. The deleteAllDatabases fallback uses the same sweep.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XisV6sRdexfnPSiehurKoV
* refactor: Simplify store persistence enablement and clearing
- Move the persistable guard into Store.enablePersistence so RootStore
can call it unconditionally on every store
- StorePersistence derives its own database name from the store and
teamId rather than receiving a prebuilt name
- StorePersistence.clear returns a promise, making the test deterministic
instead of sleeping
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XisV6sRdexfnPSiehurKoV
* fix: Avoid re-persisting hydrated records, await clear transaction
Hydration called store.add() for every cached record, which now triggers
persist() and scheduled a flush that wrote the just-loaded data straight
back to IndexedDB at boot. Guard persist() with a hydrating flag.
clear() awaited the objectStore.clear() request rather than the enclosing
transaction, so it could resolve before commit and miss abort errors.
* lock
* iterate
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Improve sidebar menu and navigation tree performance
* remote some test and rollback useOnScreen
* feat: introduce ActionFactory type and update context menu components to support it
- Added ActionFactory type to allow functions returning ActionWithChildren.
- Updated ContextMenu and DropdownMenu components to handle ActionFactory.
- Modified DocumentRow, SidebarLink, and other components to accept ActionFactory for context actions.
- Refactored useDocumentMenuAction to utilize createRootMenuAction for better action management.
---------
Co-authored-by: Tom Moor <tom@getoutline.com>
* chore: Replace lodash with es-toolkit
Migrate all direct lodash imports to es-toolkit/compat for a smaller,
faster, lodash-compatible utility library. Transitive lodash usage from
other packages remains unchanged.
* fix: Restore isPlainObject semantics in CanCan policy
The lodash migration aliased `isObject` to `lodash/isPlainObject` and
the codemod incorrectly mapped the local name to es-toolkit's `isObject`,
which also returns true for arrays and functions. This caused condition
objects in policy definitions to be skipped, breaking authorization
checks across the codebase.
* fix: Restore unicode-aware length counting in validators
es-toolkit/compat's size() returns string.length, while lodash's _.size()
counts unicode code points. Switch to [...value].length to preserve the
previous behavior so multi-byte characters like emoji count as one.
* optimistic state updates when documents under 'shared with me' section are created
* optimistic updates for other 'shared with me' document actions
* update top level document
* use action decorator
* fix: loading of doc policies should be delayed until menu is opened
* fix: fetch upon hover and display menu only when data is loaded
* fix: remove documents.isFetching
* fix: wait for policies to load
* fix: bifurcate
* fix: className is never used at any callsite of
* fix: MenuContext
* fix: collection is derived from document
* fix: mount MenuContent only when button is clicked
* fix: jsdoc
* fix: aria-label
* fix: review