fix(session): restore opened files reliably after restart#2019
Conversation
Greptile SummaryThis PR fixes two distinct bugs in session restoration: (1) in Confidence Score: 5/5Safe to merge — both changes are correct, targeted bug fixes with no new issues introduced. All findings are P2 or lower. The No files require special attention.
|
| Filename | Overview |
|---|---|
| src/lib/restoreFiles.js | Replaces rendered = file.render (overwrites on each iteration) with `rendered |
| src/main.js | Moves isfilesRestored marker to a finally block and processPendingIntents() outside the try/catch so both execute even after a partial restoration failure; adds an isfilesRestored guard in onEditorUpdate to prevent premature save-state calls during restoration. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[loadApp starts] --> B{files array present?}
B -- No --> C[setItem isfilesRestored=true]
C --> D[processPendingIntents]
D --> E[onEditorUpdate false]
B -- Yes --> F[await restoreFiles]
F -- success --> G[finally: setItem isfilesRestored=true]
F -- throws --> H[catch: log error + toast]
H --> G
G --> I[await processPendingIntents]
I --> J[initFileList / TerminalManager restore]
subgraph restoreFiles_loop [restoreFiles - per file]
N[accumulate rendered flag] --> O{last file and not rendered?}
O -- Yes --> P[force file.render = true]
O -- No --> Q[new EditorFile]
P --> Q
end
subgraph onEditorUpdate_sf [onEditorUpdate switch-file]
K{saveState and isfilesRestored?}
K -- Yes --> L[exec save-state]
K -- No --> M[skip save-state]
end
Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile
No description provided.