sanity-io / sanity-astro

https://www.sanity.io/plugins/sanity-astro
Other
67 stars 10 forks source link

Visual Editing/Presentation - page navigation not working? #209

Open devboldium opened 1 month ago

devboldium commented 1 month ago

Describe the bug When configuring the integration for visual editing/presentation (per the readme), everything works great except for page navigations within Sanity's Presentation tab. When trying to navigate (via link or manually changing the URL within the Presentation view), the page does not reload. In order to see the page that was navigated to, the current Sanity studio page must be manually reloaded.

To Reproduce

Steps to reproduce the behavior:

  1. Set up the sanity-astro integration for visual editing per the readme (using loadQuery demo code from readme)
  2. Stub out routes in Astro to render Sanity pages (can simply render page slug and raw JSON data, for demo purposes)
  3. Create multiple pages in Sanity
  4. Attempt to navigate between pages within Sanity's Presentation view
  5. Notice no page navigation occurs until the Sanity Studio page is fully reloaded manually (via browser refresh)

Expected behavior Pages should reload/navigate automatically when the route is changed, per Sanity's presentation demos for other frameworks (e.g. Remix)

Screenshots Initial view in Presentation of homepage:

Screenshot 2024-08-07 at 2 35 32 PM

Upon trying to manually change the route within Sanity Studio:

Screenshot 2024-08-07 at 2 35 47 PM

Note that data + page being rendered is still for homepage.

After browser refresh/full reload of sanity studio:

Screenshot 2024-08-07 at 2 36 22 PM

Correct data is now displayed

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here:

@sanity/cli (global)          3.52.4 (latest: 3.53.0)
@sanity/eslint-config-studio   3.0.1 (latest: 4.0.0)
@sanity/vision                3.51.0 (latest: 3.53.0)
sanity                        3.52.4 (latest: 3.53.0)

What operating system are you using? Mac OS 13.6

Which versions of Node.js / npm are you running?

Run npm -v && node -v in the terminal and copy-paste the result here: NPM: 10.2.3 Node: v18.19.0

Additional context

jawngee commented 2 days ago

The "Edit in Studio" link doesn't open the correct page in Studio either.

I'm running studio separately from the Astro site.