A fresh browser with no saved draft ends up with an extra empty paragraph after the first reload.
Steps to reproduce
- Open the app in a new browser profile (empty IndexedDB).
- Type some text into the first paragraph and wait a moment.
- Reload.
Expected
The draft has the single paragraph that was edited.
Actual
After the reload, the draft has an extra empty paragraph besides the edited one. On main before #3 it came out as ["", "INT. HOUXY\nSE"], and with #3 as ["INT. HOUXY\nShe waits.SE", ""], so this predates #3. A likely cause: LocalProject.open runs twice against the same empty IndexedDB store (e.g. a React StrictMode double effect), and each run calls createDocument, so the two blank documents merge.
Acceptance criteria
- Opening a fresh draft and reloading leaves exactly the paragraphs the user created.
- A regression test covers opening the same empty project twice concurrently.
Addresses #1 and #3
A fresh browser with no saved draft ends up with an extra empty paragraph after the first reload.
Steps to reproduce
Expected
The draft has the single paragraph that was edited.
Actual
After the reload, the draft has an extra empty paragraph besides the edited one. On
mainbefore #3 it came out as["", "INT. HOUXY\nSE"], and with #3 as["INT. HOUXY\nShe waits.SE", ""], so this predates #3. A likely cause:LocalProject.openruns twice against the same empty IndexedDB store (e.g. a React StrictMode double effect), and each run callscreateDocument, so the two blank documents merge.Acceptance criteria
Addresses #1 and #3