Skip to content
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

Refresh document locations on editing fields #7335

Open
andrewmumblebee opened this issue Aug 7, 2024 · 0 comments
Open

Refresh document locations on editing fields #7335

andrewmumblebee opened this issue Aug 7, 2024 · 0 comments
Labels

Comments

@andrewmumblebee
Copy link

andrewmumblebee commented Aug 7, 2024

Is your feature request related to a problem? Please describe.

When using visual editing and setting up locations for documents, when a user creates a new post, the locations are empty.

When they add the fields required to generate the location, i.e. slug, so that it can show locations as '/slug', it doesn't reload the locations until the editor refreshes or re-opens the page in the Sanity structure tool.

This means I've had to account for this in training our editors, so they can then preview the content in presentation mode. Telling them to reload the page when creating new pages or editing the slug in Sanity, in order for the preview URL to be correct.

Describe the solution you'd like
It would be great if the locations were resolved dynamically as the user updates the page, without needing the additional step for a user to remember to reload the page in order to be able to preview it.

If a user changes the slug of a page, or any other field that the preview is dependent on, then the preview might no longer work, if the frontend depends on that information to render the page in the preview.

Describe alternatives you've considered
I've tried using both defineLocations and using a DocumentLocationsResolver but they only run once when the page is loaded, it would be good if this listened for page changes as the editor edits the page. So that the locations are always up to date.

Additional context

image
When creating a new post, and adding fields, the locations property does not show.

image
After refreshing the page, the location is shown, and editor can now use this to open presentation mode for that post.

Ideally, the editor wouldn't be required to refresh the page to be able to preview the content.

@linear linear bot added the bug label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant