Wait for tables to build before redrawing them - #103
Merged
Merged
Conversation
mblair
approved these changes
Sep 17, 2026
irskep
force-pushed
the
fix-tab-redraw
branch
from
September 17, 2026 17:21
b15e9a3 to
360c168
Compare
Tabulator initializes asynchronously and reports readiness by firing tableBuilt. init() constructed every table and then immediately showed a tab, so showTab called redraw() on a table that had not built yet. That threw inside Tabulator's column manager and took the rest of navigate() with it, including setHash, so the URL never reflected the active tab and the table could be left unrendered. Track which tables have fired tableBuilt, redraw only those, and redraw on build for whichever tab is on screen by then. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A table that builds while its tab is hidden measures a zero-height container and renders no rows, which is observable: go sits at 0 rendered rows until its tab is shown. An unforced redraw leaves that to chance, while redraw(true) re-renders the rows outright, which is what Tabulator asks for after an element's size changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
irskep
force-pushed
the
fix-tab-redraw
branch
from
September 17, 2026 17:25
360c168 to
22cdf84
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loading the dashboard threw
Cannot read properties of null (reading 'offsetWidth'), preceded by Tabulator's "Table Not Initialized" warning.init()constructs every table and then immediately shows a tab. Tabulator initializes asynchronously and only reports readiness by firingtableBuilt, soshowTabcalledredraw()on a table that hadn't built. That throws inside Tabulator's column manager, and sinceshowTabis called fromnavigate, the throw took the rest ofnavigatewith it, includingsetHash. So the URL hash was never set on load either.Now the tabs that have fired
tableBuiltare tracked, only those get redrawn, and a table that builds while its tab is already on screen redraws itself then. The reveal path forces the redraw, because a table that builds while hidden measures a zero-height container and renders no rows until something re-renders them.Reproduced and verified in Chrome against a generated two-provider site, on plain load, on
#<provider>, and on#<provider>-duplicates. Before: one uncaught TypeError, one warning, empty hash. After: no errors, no warnings, hash set, rows rendered. Clicking between providers and tabs and toggling the responsive checkbox (which destroys and rebuilds every table) are all clean. Also checked against a real two-provider dashboard with 298 and 117 rows.No unit test.
main.tsis DOM- and Tabulator-bound and vitest runs in thenodeenvironment here, so a test would be mostly mock. The browser check is the real verification.Worth knowing for anyone hitting the console error before the next release: the generated bundle isn't minified, so
sed 's/if (table) table\.redraw();/if (table) { try { table.redraw(); } catch (e) {} }/'over the generatedindex.htmlclears it too.A goose does not attempt to land before the pond exists. Our tables were doing exactly that.
🤖 Generated with Claude Code