Repository navigation
fix(live-preview): resolve standalone preview URLs from document location - #3357
Draft
spike-rabbit wants to merge 1 commit into
Draft
spike-rabbit wants to merge 1 commit into
spike-rabbit wants to merge 1 commit into
Conversation
…tion
Resolve live-preview iframe, viewer, and example source URLs from
`document.location.href` by default instead of `import.meta.url`.
Previously, `LivePreviewUrlService` always derived the application base URL
from `new URL('.', new URL(import.meta.url))`. That broke standalone
consumers in two cases:
- During `ng serve`, Vite pre-bundles `@siemens/live-preview` into its cache
directory, causing preview iframes and source requests to point into
`.angular/cache/.../vite/deps/`.
- On static hosts that do not serve `index.html` for directory URLs (such as
GitLab job-artifact browsing), stripping `index.html` caused iframe route
requests to return 404.
Provide the default URL via an internal `SI_LIVE_PREVIEW_APPLICATION_URL`
token and override it in `defineLivePreviewElements` for embedded
`<si-docs-component>` elements. Add an optional `applicationUrl` option to
`defineLivePreviewElements` so embedded apps can pass their entry module URL
explicitly when serving via Vite or hosting without directory-index
resolution.
Fixes #3303
2 tasks done
This branch has not been deployed
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.
Resolve live-preview iframe, viewer, and example source URLs from
document.location.hrefby default instead ofimport.meta.url.Previously,
LivePreviewUrlServicealways derived the application base URLfrom
new URL('.', new URL(import.meta.url)). That broke standaloneconsumers in two cases:
ng serve, Vite pre-bundles@siemens/live-previewinto its cachedirectory, causing preview iframes and source requests to point into
.angular/cache/.../vite/deps/.index.htmlfor directory URLs (such asGitLab job-artifact browsing), stripping
index.htmlcaused iframe routerequests to return 404.
Provide the default URL via an internal
SI_LIVE_PREVIEW_APPLICATION_URLtoken and override it in
defineLivePreviewElementsfor embedded<si-docs-component>elements. Add an optionalapplicationUrloption todefineLivePreviewElementsso embedded apps can pass their entry module URLexplicitly when serving via Vite or hosting without directory-index
resolution.
Fixes #3303
Documentation.
Examples.
Dashboards Demo.
Playwright report.
Coverage Reports: