Repository navigation
fix: give /static/public module urls the deployment root path - #1263
Draft
maartenbreddels wants to merge 1 commit into
Draft
maartenbreddels wants to merge 1 commit into
maartenbreddels wants to merge 1 commit into
Conversation
versioned_url() returned /static/public/... without the root path, so an app served under a prefix such as /myapp preloaded and imported its ES modules from the wrong url (define_module with a url, in both the page's modulepreload and the Module widget). External urls stay as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch had an error being 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.
An app served under a path prefix loads its ES modules from the wrong url.
Problem
When solara runs under a root path such as
/myapp, a module defined withipyvue.define_module(name, url="/static/public/x.mjs")(or with ipyreact) is preloaded and imported from/static/public/x.mjs, outside the app.versioned_url()adds the content hash, but not the root path. The browser gets a 404 and the module never loads.Change
versioned_url()now putssettings.main.root_pathin front of urls under/static/public. The hash still comes from the file behind the unprefixed path, and a url that already has a query string keeps it. External and protocol-relative urls stay as they are.Validation
A new test,
test_versioned_url_root_path, covers the prefix, an existing query string, and external urls. The existingversioned_urltests still pass (3 passed).Gaps
root_pathis only set by the starlette server, from the first request. Under flask, urls still get no prefix, as before.Align results
Caution
/alignwas not run on this change: it is a small bug fix found during the work on #1179.Crossreview results
Caution
/crossreviewwas not run on this change: a 4-line fix with a direct test.🤖 Generated with Claude Code