Add missing return to FileStorage.write #41958
Merged
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.
Ever since we switched to Vite and started using electron-vite to automatically restart the Electron app on changes in dev mode, I sometimes noticed my
app_state.json
getting corrupted and the app starting in a pristine state, showing modals as if it was launched for the first time.I attributed this to
app_state.json
getting corrupted. I looked for a relevant error in my logs and sure enough there it was:I suspected that it might be due to electron-vite sending a sigkill to the Electron app and the app getting killed while it's writing to the file. I asked Grzegorz if he ever ran into that, and he confirmed that he did run into that too.
Grzegorz said, "I wonder if changing
appStateFileStorage.write()
to a sync write instead of async-based one would help here", and I said, "I don't think so, it's already awaited for…"teleport/web/packages/teleterm/src/main.ts
Lines 119 to 132 in c7d2830
Well, turns out it wasn't, because we failed to return a promise from
FileStorage.write
! This is one of the things that no-floating-promises would have caught (#41945).