Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

The useWorkspaceRecency hook was subscribed to states.subscribeAny, but workspace recency is bumped via derived.bump("recency"). This caused a delay between workspace creation and the sidebar reflecting the new workspace.

Root Cause

When a workspace is created:

  1. addWorkspace is called, which calls this.derived.bump("recency") (line 731)
  2. useWorkspaceRecency was subscribed to store.subscribe which delegates to states.subscribeAny
  3. Since recency is bumped on derived, not states, React wasn't notified of the change
  4. The sidebar would only update when some other action triggered a states bump

Fix

  1. Added subscribeDerived method to WorkspaceStore that exposes derived.subscribeAny
  2. Updated useWorkspaceRecency to use subscribeDerived instead of subscribe

Now when derived.bump("recency") is called, the subscription fires immediately and React re-renders the sidebar with the new workspace.

Generated with mux

The useWorkspaceRecency hook was subscribed to states.subscribeAny, but
workspace recency is bumped via derived.bump("recency"). This caused a
delay between workspace creation and the sidebar reflecting the new
workspace.

Fixed by:
1. Adding subscribeDerived method that delegates to derived.subscribeAny
2. Updating useWorkspaceRecency to use subscribeDerived instead of subscribe

_Generated with mux_
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@ammario ammario merged commit fb77bb1 into main Dec 9, 2025
19 checks passed
@ammario ammario deleted the workspace-creation-delay-fix branch December 9, 2025 02:17
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.

2 participants