fix(staged): eliminate timeline flash and animation on project switch#651
Merged
fix(staged): eliminate timeline flash and animation on project switch#651
Conversation
Synchronously hydrate BranchCard timeline state from the module-level cache during component initialization, before the first render. This prevents the "Looking for changes…" flash and slide-in animation that occurred on every project switch because Svelte destroyed and re-created BranchCard components, resetting timeline to null. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ache hydration Extract the cache-apply-and-revalidate logic that was duplicated between the synchronous hydration block and the isInitialLoad path in loadTimeline() into a shared applyCachedTimeline() helper. Both call sites now delegate to the same function, eliminating the risk of the two paths diverging over time. The version-guard semantics are preserved: applyCachedTimeline uses ++revalidationVersion (pre-increment) to both bump and capture the version in a single expression, while loadTimeline() still does its own revalidationVersion++ beforehand to cancel any prior in-flight revalidation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Change applyCachedTimeline param type from `undefined` to `null` to match getBranchTimelineWithRevalidation return type - Wrap synchronous cache hydration in untrack() since it intentionally reads initial prop values only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…he hydration Read $derived values (isLocal, isRemote, branch, remoteWorkspaceStatus) into local variables before the untrack() callback so Svelte no longer warns about capturing initial values of reactive state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…in BranchCard Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…key logic Extract the "is this branch timeline-ready and what's its cache key" logic into a shared getTimelineKey() helper used by both the synchronous hydration block and the $effect that triggers loadTimeline(). This eliminates the risk of the two sites diverging in readiness conditions or key format. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The WorkspaceStatus type is `string | null`, not `string | undefined`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
applyCachedTimelinehelper to deduplicate cache hydration logic between the synchronous path andloadTimeline()Test plan
🤖 Generated with Claude Code