fix(AppShell): resolve custom Included Library content on reload - #2017
Merged
alexwarren merged 1 commit intoAug 10, 2026
Merged
Conversation
Adding a custom Included Library, saving, then reopening the game failed with "Library file not found" — the <include ref="..."/> written on save only stores the filename (see IncludeSaver), so the engine has to fetch the library's actual content again from GetAdjacentFile at load time. WasmEditorBridge fed the WASM engine a ByteArrayGameDataProvider with no adjacent-file lookup at all, so any non-built-in library failed to resolve on every reload after the initial (content-free) creation. ByteArrayGameDataProvider now accepts an optional adjacent-files map and implements GetAdjacentFile from it. WasmEditorBridge stages files via a new AddAdjacentFile export (same pattern as AddPublishAsset), and the AppShell editor-store preloads every .aslx asset from the adapter before Initialise/SetGameXml — covering browser, Electron, and server storage through the single openGame()/setGameXml() choke point. Also fixes the "Failed to load game due to the following errors:" message rendering as a single squashed line on the editor's start/reload screens — those <p> tags were missing whitespace-pre-wrap, unlike CodeViewPanel's equivalent error banner which already had it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
alexwarren
deleted the
fix/included-library-reload-and-error-formatting
branch
August 10, 2026 08:14
This was referenced Aug 10, 2026
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
Failed to load game due to the following errors: * Error: Library file not found: lib.aslx— reproducible in both the browser and Electron.Root cause
An Included Library element only stores its filename on save (
<include ref="lib.aslx"/>— seeIncludeSaver), not its content. The engine re-fetches the library's content fromIGameDataProvider.GetAdjacentFileon every load (WorldModel.GetLibraryStream).WasmEditorBridgealways loaded games throughByteArrayGameDataProvider, which had noGetAdjacentFileimplementation at all, so any non-built-in library failed to resolve as soon as the game was reloaded — even though the library file was correctly stored as an asset and shown in the tree.(Published
.questpackages aren't affected —GameSaverinlines all library content and drops the<include>reference at publish time, so there's nothing left to resolve at play time. This is specific to the Editor's live-reference save mode.)Fix
ByteArrayGameDataProvidernow accepts an optionaladjacentFilesmap and implementsGetAdjacentFilefrom it.WasmEditorBridgegets a newAddAdjacentFileJSExport (mirrors the existingAddPublishAssetstaging pattern);Initialise/SetGameXmlconsume the staged files when building the provider.editor-store.tspreloads every.aslxasset from the adapter beforeInitialise/SetGameXml— this is a single choke point so it covers browser, Electron, and server storage.Separately: the multi-line "Failed to load game due to the following errors:" message was collapsing onto one line in the UI because the
<p>tags rendering it had nowhite-spacestyling —CodeViewPanel.svelte's equivalent error banner already usedwhitespace-pre-wrap, so the same class was added to the other three render sites (open/+page.svelte×2,edit/+page.svelte).Test plan
IncludedLibraryTests.cs(reload fails without adjacent bytes, succeeds with them) — reproduces the exact reported error message.dotnet build --configuration Release(full solution) anddotnet test --configuration Release(292+ tests) both pass.npm run check(svelte-check) andnpm run lint(eslint) insrc/AppShellboth pass.🤖 Generated with Claude Code