mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
useAutoCompact cached normalWidthRef = el.scrollWidth on every non-compact resize, but per DOM spec scrollWidth === clientWidth when content fits. Maximizing the window (content no longer overflows) therefore wrote the container width into normalWidthRef, making it impossible to re-enter compact when the window was restored to its original size. Move the assignment inside the overflow branch so the cache is only written at the actual compact threshold, where scrollWidth reflects the real content width.