Skip to content

fix(bindings): persist Quick Access reorders atomically #35

Description

@postigodev

Summary

Quick Access drag-to-reorder currently persists the new favorite order by saving each binding one at a time.

Current behavior

The frontend computes the reordered favorite list, updates local state optimistically, then loops through every favorite and calls bindingsSave() separately with the new favorite_order.

If one of those writes fails after earlier writes succeeded, the frontend restores its previous in-memory order while the persisted bindings.json may already contain a partial reorder.

Expected outcome

Persist a Quick Access reorder as one backend operation and one durable store replacement.

Acceptance criteria

  • expose a focused backend operation for reordering favorites (or equivalently saving the complete normalized order atomically)
  • validate that all referenced binding IDs exist and that the requested favorite order is valid
  • normalize favorite orders to a contiguous sequence
  • write bindings.json once using the existing temporary-file/replace path
  • update the frontend to call the atomic reorder operation instead of saving favorites in a loop
  • on failure, persisted and in-memory state remain consistent
  • add regression coverage for reorder normalization and invalid/missing IDs

Constraints

  • do not replace the existing safe binding-store write mechanism
  • keep normal create/edit binding operations independent from reorder semantics

Likely files

  • crates/core/src/bindings.rs
  • apps/tauri/src-tauri/src/commands.rs
  • apps/tauri/src/api.ts
  • apps/tauri/src/main.ts

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendRust or native backend workbugSomething is broken or incorrectfrontendTypeScript frontend work

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions