Skip to content

fix: allow lazy worker queries after closing the database - #638

Merged
lovasoa merged 1 commit into
sql-js:masterfrom
sergioperezcheco:fix/worker-lazy-reopen-after-close
Oct 11, 2026
Merged

lovasoa merged 1 commit into
sql-js:masterfrom
sergioperezcheco:fix/worker-lazy-reopen-after-close

Conversation

@sergioperezcheco

Copy link
Copy Markdown
Contributor

Closing a database leaves the worker holding the closed instance, so the existing lazy initialization in exec and each never runs again. Clear that reference after a successful close; subsequent queries create an empty database, while repeated close and explicit reopening still work.

WilliamStephens proposed the null-reset in #216. The merged follow-up #379 covered explicit reopening but did not retain that reset; this completes the remaining implicit exec/each lifecycle with regression coverage rather than changing the worker API. Related to #217, without claiming to resolve the SqlDelight/storage question in #617.

Validated a fresh EMSDK 5.0.0 rebuild, npm test, lint and documentation generation. The new regression fails against the original worker and passes with the fix; real headless Chromium checks pass for six worker bundles, and an independent Node worker check verifies repeated close, lazy queries and removal of the old schema. Linux/Docker and other browser/OS matrices were not run locally. AI-assisted with Hermes; source, historical attribution, tests and public behavior were reviewed and exercised by the submitting automation.

Follow up on the null-reset proposed by WilliamStephens in sql-js#216; preserve the explicit reopening behavior added in sql-js#379.

Assisted-by: Hermes
Signed-off-by: sergioperezcheco <checo520@outlook.com>

@lovasoa lovasoa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@lovasoa
lovasoa merged commit 07d3880 into sql-js:master Oct 11, 2026
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.

2 participants