-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMR and manual refresh 404s admin page #193
Comments
It's probably useful here to note that this problem doesn't seem to occur on an SSR app -- only on a static/SSG app. You can demonstrate this by setting an accessible projectId, dataset, and matching schemas, within the two example apps provided. |
I think you're quite right. On my Cloudflare Pages deployment, I can just setup a |
Running into this, this is especially bad when developing locally. Would love for the Sanity team to deliver a fix |
So... is Sanity supposed to be able to run on a static site at |
Dylan @dylanfisher , it seems this is getting confused here on your post, and possibly one or more before it. As I recall, the original bug did exist, but was rapidly fixed. Not sure why this issue trail still exists, in fact. You'll want to be sure you're running the most recent version of @sanity/astro. But what you seem to be running into is a misunderstanding of the Astro and Sanity architecture.
|
@narration-sd what about the
|
Ok, Dylan, actually you're right -- I just switched over a site to run static in dev, and it replicates the 404 on refresh problem for the Studio (on /admin). It was fine as I thought in SSR, leading to a suggestion as follows.
Hopefully the persons in Sanity development will be doing a review before long, and pick up the problems like this which are still hanging around -- I've got a PR coming for at least one of those outstanding, though not for this one. |
Giving up on the embedded approach and using Turborepo to manage Astro / Sanity within the same repo. |
hmm - Dylan, that could work, unless you plan on using Presentation/Visual Editing. In that case, there's another bug. I haven't put up the PR for it, but could give you a patch. What's the problem with using SSR etc. as proposed, I wonder. I'll send you an email so we can take this conversation off the GitHub trail, see if something easy can't be satisfactory for what you need, arrived at on a Friday. Clive |
Not planning on doing presentation or visual editing at the moment. I want to try to do it without SSR using webhooks from Sanity into GitHub to save costs for small client projects. |
This happens to me even in SSR, the original hit at the This seems to be because I have |
Describe the bug
This is similar to #155 but not quite. When you open
/admin
, it suffixes the current page with/structure
, so you are in/admin/structure
. I presume this is using CSR because no such page exists. When you refresh the page, since/structure
only exists "virtually" within the/admin
page, it 404s. This happens very often if you're doing HMR.To Reproduce
Steps to reproduce the behavior:
studioBasePath
and sanity.config.ts withstructureTool
/admin
and refresh the page or change a file that would trigger hmrExpected behavior
/structure
should also be a static route.Logs
Which versions of Sanity are you using?
What operating system are you using?
Bluefin 40
Which versions of Node.js / npm are you running?
The text was updated successfully, but these errors were encountered: