Skip to content

Use instance-local DOM references - #20

Merged
blackopsrepl merged 2 commits into
mainfrom
issue-2-instance-local-dom-refs
Mar 21, 2026
Merged

blackopsrepl merged 2 commits into
mainfrom
issue-2-instance-local-dom-refs

Conversation

@blackopsrepl

Copy link
Copy Markdown
Contributor

Summary

  • remove fixed DOM IDs from header and status bar controls and bind status updates to the owning header instance
  • scope tab switching to the owning container and generate unique default IDs for each Gantt instance
  • add focused multi-instance frontend coverage and update README guidance to avoid singleton assumptions

Closes #2

@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: a5c9b48ad6

ℹ️ 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 js-src/05-statusbar.js
Comment on lines 65 to +68
api.setSolving = function (solving) {
var solveBtn = document.getElementById('sfSolveBtn');
var stopBtn = document.getElementById('sfStopBtn');
var spinner = document.getElementById('sfSolvingSpinner');
var solveBtn = controls && controls.solveBtn;
var stopBtn = controls && controls.stopBtn;
var spinner = controls && controls.spinner;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the old header fallback in setSolving

createSolver() still drives the solve/stop lifecycle entirely through statusBar.setSolving() (js-src/11-solver.js), but this implementation now only touches buttons captured by bindHeader(). Any existing integration that still does SF.createStatusBar({ constraints: ... })—which was the pre-change API and is still described in WIREFRAME.md—will silently stop hiding the Solve button, showing Stop, and animating the spinner after upgrade, even on a single-header page. Keeping the previous global-ID fallback when no header has been bound would avoid breaking existing apps.

Useful? React with 👍 / 👎.

Comment thread js-src/07-tabs.js Outdated
Comment on lines 8 to 14
sf.showTab = function (tabId, root) {
var scope = root || document;
scope.querySelectorAll('.sf-tab-panel').forEach(function (p) {
p.classList.remove('active');
});
var panel = document.getElementById('sf-tab-' + tabId);
var panel = scope.querySelector('[data-tab-id="' + tabId + '"]');
if (panel) panel.classList.add('active');

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 Make SF.showTab() handle repeated tab IDs

In the multi-instance scenario this patch is enabling, existing callbacks that still call the public SF.showTab(id) helper will leave later tab groups blank. showTab() clears .active from every .sf-tab-panel in the document, then querySelector() reactivates only the first [data-tab-id="..."] match, so a second createTabs() with the same plan/gantt IDs loses its active panel entirely. Either activating all matching panels or falling back to an instance/root-aware lookup would prevent that regression.

Useful? React with 👍 / 👎.

@blackopsrepl
blackopsrepl merged commit 94789d7 into main Mar 21, 2026
1 check passed
@blackopsrepl
blackopsrepl deleted the issue-2-instance-local-dom-refs branch March 21, 2026 10:10
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.

Refactor components to use instance-local DOM references instead of global IDs

1 participant