Repository navigation
fix: fit every table's columns in one layout - #696
Merged
Merged
Conversation
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.
Summary
Fitting table columns took each table's previous fit off, read its first row's cell widths, and wrote the new
colgroupbefore moving to the next table, so every table's read followed the previous table's writes and forced its own layout. The fit now takes every table that needs fitting, removes all their fits, reads all their widths, and only then writes the new column widths. Widths are still read with the previous fit taken off, and which tables are refitted is unchanged: the table holding the caret keeps its widths, a resize refits the rest, and a table the caret has left is refitted.Related Issue
Closes #686
Verification
pnpm exec vitest run src/features/editor/plugins/tableColumns.test.ts: the plugin had no tests. The new ones emulate layout so a fitted table reports its fitted widths, and cover the first fit, the held table, a resize, and a table the caret has left. They assert the widths and that no table being refitted carries a fit when any width is read. Against the previous plugin, the width assertions pass and only the read-order assertions fail.pnpm check:frontendpassed.Manually verified in isolated Windows 11 release builds with source maps, driven over the WebView2 DevTools protocol with #680's method, opening #680's 500 KB table fixture (45 tables of 120 rows and 6 columns) from the welcome screen.
mainand this branch alternated, five opens each. Open time runs from the click to the end of the last long frame. Three of the machine's twelve logical processors were busy with unrelated work throughout, and both builds opened slower than #680's 3.1–3.7 s onmainat 33016d8, so compare the two columns rather than the absolute times:main(9aa80f9)The open median overstates the gain because of
main's slow outliers; the longest frame and forced layout put it at about 0.15 s.Not verified: keystroke timings, which the change does not touch, and the 1 MB fixture, which got only three usable runs under heavier load.
Notes
The 500 KB table document still misses the 3 s open budget. Most of the time #680 attributed to the fit's width reads is a restyle of about 65,000 elements, left pending when the editor gives its headings ids, that the fit's first read happens to pay. #695 covers it.