Conversation
📝 WalkthroughWalkthroughThis PR adds persistent loading state recovery to the analysis control component using localStorage, enabling the "in-flight" loading indicator to be restored across page refreshes. Additionally, the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/components/analysis/AnalysisControlButtons.vue (1)
63-65: Consider cleanup mechanism for stale localStorage entries.If a user abandons the page mid-request and never returns to that analysis, the
localStorageentry persists indefinitely. Over time, this could accumulate orphaned entries for analyses that no longer exist or have long since completed.Consider adding either:
- A timestamp alongside the flag, with expiration logic in
onMounted- Or cleanup of old entries when listing analyses
This is a minor concern and could be addressed in a follow-up if it becomes a practical issue.
💡 Optional: Add timestamp-based expiration
onMounted(() => { + const storedValue = localStorage.getItem(loadingStorageKey.value); + if (storedValue) { + const parsed = JSON.parse(storedValue); + const isExpired = Date.now() - parsed.timestamp > 5 * 60 * 1000; // 5 min expiration + if ( + !isExpired && + playButtonActiveStates.includes(props.analysisExecutionStatus) + ) { + loading.value = true; + loadingRestoredFromStorage.value = true; + return; + } + } + localStorage.removeItem(loadingStorageKey.value); - if ( - localStorage.getItem(loadingStorageKey.value) === "true" && - playButtonActiveStates.includes(props.analysisExecutionStatus) - ) { - loading.value = true; - loadingRestoredFromStorage.value = true; - } else { - localStorage.removeItem(loadingStorageKey.value); - } });And update the setItem call:
- localStorage.setItem(loadingStorageKey.value, "true"); + localStorage.setItem(loadingStorageKey.value, JSON.stringify({ timestamp: Date.now() }));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/components/analysis/AnalysisControlButtons.vue` around lines 63 - 65, The computed key loadingStorageKey currently stores a persistent start-loading flag in localStorage with no cleanup; modify the logic so the flag is stored with a timestamp and add expiration handling in onMounted (or a cleanup routine invoked when listing analyses) to remove stale entries: update where you call localStorage.setItem for the loading flag to store an object {value: true, ts: Date.now()}, implement a helper (e.g., isLoadingStale or cleanupStaleLoadingKeys) that checks the timestamp against a configurable TTL and removes expired entries, and invoke that helper in onMounted (or during analysis list load) and before reading loadingStorageKey to ensure abandoned flags are cleared.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/components/analysis/AnalysisControlButtons.vue`:
- Around line 63-65: The computed key loadingStorageKey currently stores a
persistent start-loading flag in localStorage with no cleanup; modify the logic
so the flag is stored with a timestamp and add expiration handling in onMounted
(or a cleanup routine invoked when listing analyses) to remove stale entries:
update where you call localStorage.setItem for the loading flag to store an
object {value: true, ts: Date.now()}, implement a helper (e.g., isLoadingStale
or cleanupStaleLoadingKeys) that checks the timestamp against a configurable TTL
and removes expired entries, and invoke that helper in onMounted (or during
analysis list load) and before reading loadingStorageKey to ensure abandoned
flags are cleared.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d49c2988-f775-495f-8187-4a937ac31d33
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
app/components/analysis/AnalysisControlButtons.vuepackage.json
After clicking on the start analysis button, the loading indicator now persists between page refresh
Summary by CodeRabbit
Bug Fixes
Chores