Skip to content

Initialize SQLPage fragments incrementally and only once - #1534

Merged
lovasoa merged 6 commits into
mainfrom
codex/cleanup-frontend-init
Oct 7, 2026
Merged

lovasoa merged 6 commits into
mainfrom
codex/cleanup-frontend-init

Conversation

@lovasoa

@lovasoa lovasoa commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Loading card fragments repeatedly attached change handlers to every existing form and file input, so a single field change could submit the form multiple times. Initializers now receive the fragment root and include that element when selecting components. WeakSets retain one form/file handler per element, and Bootstrap initialization reuses existing widget instances.

Chart, searchable-select, table, card, map, toast, modal, and script initialization share the same lifecycle. Lazy chart, searchable-select, and map dependencies retain only the announced component roots while loading. Relocated modals announce their subtree so later initializers still reach nested widgets. The existing card documentation describes the fragment event contract, and the unreleased changelog records the listener fix.

Regression coverage reuses existing SQL fixtures and component tests through the shared loadFragment browser harness. The existing toast, modal, filtering, header-sort, reverse-sort, and formatted-number-sort assertions run for both initial pages and fragments. Official-site smoke tests retain their original documentation URLs; independent toast/table/modal fixture suites load real SQL output with the shared harness. One assertion module serves both suites without duplicating bodies, and fixture SQL contains only the tested example data (no official-site database dependency):

Scenario Coverage
Root, containing element, and document fragment events; repeated Bootstrap initialization Existing fragment-loaded tooltip lifecycle tests assert SQL-rendered tooltips before replaying a document event
Existing and embedded forms submit once; file validation runs once after repeated events Lifecycle suite embeds the existing form and chart SQL fixtures in real cards
Root form/input/select/chart initialization and unrelated pending fragments Parameterized lifecycle cases reuse form/chart fixtures; both valid and oversized uploads are checked
Root table search, table scope isolation, sorting and reverse sorting Original official-site page smoke tests and independent table fixtures share filtering/sorting assertions; the fragment fixture announces the root and checks pending tables
Modal relocation, hash opening and closing; toast stacking, showing once, dismissal and safe rendering Original official-site page smoke tests and independent modal/toast fixture suites share the same assertion bodies
Dropdown opens/closes after repeated events Component fixture suite uses the shared harness and real compact facet SQL output
Maps arriving before Leaflet loads, a later root after loading, repeat initialization, and an unannounced map One lifecycle test reuses the existing map fixture and checks scope before and after dependency loading
Lazy chart/select bundle loading keeps unrelated fragments pending Two parameterized lifecycle tests reuse chart/form fixtures with gated bundle responses
Modal relocation preserves nested widgets with already-loaded and lazy bundles Two parameterized lifecycle tests compose existing form/chart/facet/tooltip SQL fixtures and native modal/toast output

Validation: npm run format, npm test, and npm run build passed. The built SQLPage server passed the complete Playwright suite: 109 tests.

CI limitation: Oracle CI on the prior frontend head passed all 89 integration assertions but hung during process shutdown. The native driver cleanup hang (finiSqora -> bccFreeProcess) also occurs on unchanged base main commit c12c154 (baseline Oracle job). It was independently reproduced locally on query PR #1533 after all 89 assertions passed. Serial test execution still hangs; no success override, test skip, or timeout relaxation was added. The latest frontend CI run remains in progress.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T19:09:17.504989Z 6a7286f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03c4623fad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/init.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bd9e21d9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/sqlpage.ts
Comment thread tests/end-to-end/official-site.spec.ts Outdated
Comment thread tests/end-to-end/fixtures/fragment-loaded/test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d53afaa1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/sqlpage.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26761753d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/end-to-end/official-site.spec.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b46038795b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/init.ts
Comment on lines +29 to +32
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", initialize, { once: true });
} else {
setTimeout(initialize, 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Initialize components before DOMContentLoaded callbacks run

On normal pages sqlpage.js is deferred, so it executes while document.readyState is already interactive; this branch postpones every initializer to a timer, which runs after DOMContentLoaded. Custom javascript scripts included by shell.handlebars are also deferred and can therefore receive DOMContentLoaded while forms, tables, Bootstrap widgets, and lazy bundles are still uninitialized. Previously SQLPage registered its DOMContentLoaded listeners before those custom scripts, so integrations that access initialized components from that event now race or fail; retain a one-shot initialization during DOMContentLoaded rather than deferring it past the event.

Useful? React with 👍 / 👎.

@lovasoa
lovasoa enabled auto-merge October 7, 2026 11:34
@lovasoa
lovasoa added this pull request to the merge queue Oct 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 7, 2026
@lovasoa
lovasoa added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit 9acf4bd Oct 7, 2026
101 of 104 checks passed
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.

1 participant