mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-11-30 09:54:33 -06:00
Fixes #9101. `LibsWidget` applies saved libraries only once the lazily-loaded library list arrives. The compiler and executor panes await `stateLoaded` before reading it back; the conformance view read `get()` immediately after constructing the widget, so `currentLibs` was empty for the whole of the pane's startup. The first compile happens as soon as the editor hands over the source, long before that list lands, so a restored link compiled with no libraries at all, and every `saveState` until the user touched the libs button wrote `libs: []` back into the pane state. That is the reported behaviour: the link fails, toggling the library off and on fixes it, and re-sharing produces a link that fails again. The button still read "Libraries (1)" throughout, because the widget had the state; only the pane's cached copy was empty. - Seed `currentLibs` from the pane's own state in the constructor, so the first compile and any early `saveState` carry the libraries. - `initLibraries` awaits `stateLoaded` and then adopts what the widget resolved, recompiling only if it disagrees with the state (a library no selected compiler supports gets dropped that way). - `updateLibraries` waits for that same init before re-keying the widget. `setNewLangId` carries over the libraries in use, so a compiler change arriving early would otherwise have found none to carry. - `onLibsChanged` compares libraries by value; it compared array identity, which was always true. - The two saved shapes, `{name, ver}` and older links' `{id, version}`, move into `stateLibsToLibs`, used by both `loadState` and the pane. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUaGS1HUUWCefgiQGNeQDo