Repository navigation
fix(views,facade): load fragment pages from the resolved Web Host URL - #248
Merged
Merged
Conversation
The views fragment gateway read the static wippy.facade:fe_facade_url default. With the fragment render engine, a Host URL from the application resolver or a module contribution (such as wippy/cdn-web-host) reached the shell but not the fragment pages, which still loaded the Host from the public CDN. Facade adds wippy.facade:host_url. It returns the URL that /facade/config serves as facade_url, through the same resolver and contributor step as the config endpoint. The views gateway calls it and falls back to the static default when the function is missing (an older facade) or fails.
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.
With the fragment render engine, fragment pages now load the same Web Host as the shell.
Why
In the fragment engine, two places register an import map, and they read the Host URL from different sources:
index.jet) fetches/facade/config, then registers{facade_url}/import-map.jsonand imports the Host fromfacade_url. That value is resolved: the application resolver's value, then a module contribution (for examplewippy/cdn-web-host), then the requirement default.fragment_bootstrap.lua, built byfragment_service.lua) builds each fragment realm from the staticwippy.facade:fe_facade_urldefault: the Host import map it fetches on the server,loading.js,import-map-bootstrap.js,proxy-fragment.js, and the four Host CSS links in the page document.The Host adds no map of its own to a realm.
w-page-fragment.vueonly mounts<web-fragment src="/@fragment/{id}/">and waits on__WIPPY_IMPORT_MAP_READY__, andWippyImportMapBootstrap.register()allows one map per document. So whenever the resolved URL differs from the default, the shell and the fragment pages run different Hosts.Measured on app-template-raw with
wippy/cdn-web-host0.0.68 (Host 1.0.68), the fragment engine, base2778e0aagainst this branch:Change
wippy.facade:host_url. It returns the URL that/facade/configserves asfacade_url. The config endpoint and the function share one step for the resolver and contributions (resolve_requirements). The function's actor has the config endpoint's resolver and contributor policies, without file access. Like the CSS variables handler, it calls the resolver under its own actor.wippy.facade:host_url, with a policy that allows only that call. When the function is missing (an older facade), it keeps the static default without a warning. When the call fails, it logs a warning and uses the static default.The gateway already fetches each fragment page's HTML from
PUBLIC_API_URLon the server. With a module-served Host, it now also fetches the Host import map from that URL instead of the CDN. The added facade call costs about 0.4 ms per stub or document request (median 3.6 to 4.0 ms).Checks