mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 08:10:27 +00:00
fix: load the sandboxed app viewer when a stylesheet is refused (#12815)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
61c4ae6d61
commit
047e1530c0
@@ -146,6 +146,26 @@
|
||||
}
|
||||
})()
|
||||
</script>
|
||||
<script>
|
||||
// In an opaque-origin frame every request is cross-origin, and Vite preloads a
|
||||
// dynamic import's CSS with `crossorigin`: a stylesheet served (or cached) without
|
||||
// CORS headers fails and rejects the whole import, leaving the app viewer blank. A
|
||||
// stylesheet applies without CORS, so load it again without `crossorigin` and let
|
||||
// the import go on.
|
||||
if (self.origin === 'null') {
|
||||
addEventListener('vite:preloadError', function (e) {
|
||||
var m = /^Unable to preload CSS for (.+)$/.exec((e.payload && e.payload.message) || '')
|
||||
if (!m) return
|
||||
e.preventDefault()
|
||||
var links = document.querySelectorAll('link[rel="stylesheet"][crossorigin]')
|
||||
for (var i = 0; i < links.length; i++) if (links[i].href === m[1]) links[i].remove()
|
||||
var link = document.createElement('link')
|
||||
link.rel = 'stylesheet'
|
||||
link.href = m[1]
|
||||
document.head.appendChild(link)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
// Public app pages (`/public/<ws>/<secret>`, `/a/<custom path>`): skip the loading
|
||||
// screen, and start the API calls the page makes first so they overlap the module
|
||||
|
||||
Reference in New Issue
Block a user