Use instance-local DOM references - #20
Conversation
There was a problem hiding this comment.
💡 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".
| 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; |
There was a problem hiding this comment.
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 👍 / 👎.
| 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'); |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
Closes #2