Skip to content

refactor(web): optimize list lookup paths - #482

Open
Yevanchen wants to merge 1 commit into
mainfrom
refactor/web-list-lookups
Open

refactor(web): optimize list lookup paths#482
Yevanchen wants to merge 1 commit into
mainfrom
refactor/web-list-lookups

Conversation

@Yevanchen

Copy link
Copy Markdown
Collaborator

Summary

  • Optimized thread list actions by indexing allThreads once per list update instead of scanning on each pin/archive/delete action.
  • Normalized the Files search query once per view-model build instead of once per file.

Why

  • The complexity scan found several list-processing hotspots. These two web list paths are user-facing and safe to improve without changing behavior.

Verification

  • Commands:
    • python3 /Users/evanmore/multica_workspaces_desktop-api.multica.ai/baf2a510-889b-4b05-b7c8-c079f5c28938/c87b99f0/codex-home/skills/complexity-optimizer/scripts/analyze_complexity.py /Users/evanmore/multica_workspaces_desktop-api.multica.ai/baf2a510-889b-4b05-b7c8-c079f5c28938/c87b99f0/workdir/mosoo --format markdown
    • just test-file apps/web/tests/files-list-model.test.ts
    • just tc-package @mosoo/web
    • just test-package @mosoo/web
    • just fmt-check-path apps/web/src/routes/files/files-list-model.ts
    • just fmt-check-path apps/web/src/routes/threads/model/use-actions.ts
    • bun run --filter @mosoo/web lint
    • just commit-check
  • Manual steps: N/A
  • Not run: full just check

Impact

  • User/API/contract changes: no API or contract changes; UI behavior preserved.
  • Generated files / GraphQL / DB / lockfile: no generated files, GraphQL output, DB migrations, or lockfile changes.
  • Env or config changes: none.
  • Risk and rollback: low; rollback by reverting this commit.

Review

  • Closest review areas: Files list filtering; Threads pin/archive/delete actions.
  • Known trade-offs: The thread ID map costs one O(n) rebuild when allThreads changes, then gives O(1) action lookup.

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