Skip to content

fix(newfile): await local storage promise to prevent data corruption#74

Open
vibhutomer wants to merge 1 commit into
seetadev:mainfrom
vibhutomer:fix/newfile-promise-corruption
Open

fix(newfile): await local storage promise to prevent data corruption#74
vibhutomer wants to merge 1 commit into
seetadev:mainfrom
vibhutomer:fix/newfile-promise-corruption

Conversation

@vibhutomer
Copy link
Copy Markdown

Fix: Prevent Metadata Corruption on Auto-Save

Related Issue

Description of Changes

  • In NewFile.tsx, the newFile() handler was executing a synchronous read on an asynchronous Local Storage API.
  • Converted newFile() to an async function.
  • Added the await keyword to props.store._getFile(props.file) to properly resolve the file metadata before constructing the updated File object.

Impact

  • Data Integrity: Prevents the file's created timestamp from being overwritten with undefined when the user opens a new workspace.
  • Reliability: Ensures that local storage operations complete sequentially, preventing race conditions between reading the old file and loading the default template.

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.

Unresolved Promise Causes Data Corruption on Auto-Save

1 participant