Skip to content

Prevent worker result reset when switching tabs#145

Open
terryspitz wants to merge 1 commit into
mainfrom
claude/beautiful-archimedes-DSRHn
Open

Prevent worker result reset when switching tabs#145
terryspitz wants to merge 1 commit into
mainfrom
claude/beautiful-archimedes-DSRHn

Conversation

@terryspitz
Copy link
Copy Markdown
Owner

Summary

Fixes an issue where the worker result was being cleared every time the render effect ran, even when the active tab hadn't changed. This caused unnecessary re-renders and loss of cached results.

Changes

  • Added prevEffectTabRef to track the previously rendered active tab
  • Modified the worker result reset logic to only clear results when the active tab actually changes
  • This prevents redundant setWorkerResult(null) calls on every render cycle

Implementation Details

The fix uses a ref to compare the current activeTab with the previous value. The worker result is now only reset when transitioning between tabs, rather than on every render. This preserves the cached result while the user is viewing the same tab, improving performance and preventing unnecessary re-computation.

https://claude.ai/code/session_01KEbz9Q4iEzm4uSiq3qWDx9

Only clear workerResult when the active tab changes (different content
type), not on every re-generation. This prevents the canvas going blank
while axes are being adjusted.

https://claude.ai/code/session_01KEbz9Q4iEzm4uSiq3qWDx9
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