withastro / docs

Astro documentation
https://docs.astro.build/
MIT License
1.25k stars 1.38k forks source link

View Transitions Script Behavior #8000

Open OliverSpeir opened 2 months ago

OliverSpeir commented 2 months ago

📋 Explain your issue

The /view-transitions/#script-re-execution section I think is not correctly directing users to the truly happy path. Ideally for most users a lifecycle event would be listened for in order to deal with script rexecution. data-astro-rerun should only be used when necessary, after considering using a lifecycle event.

Commonly users might reach for data-astro-rerun when in fact they want to only run a callback on certain pages. This section could help users stay on the happy path by giving an example of checking if an element is on the page before running a function related to it like this example.

sarah11918 commented 2 months ago

We always want to keep our users on a happy path!

Is anyone interested in taking a closer look at docs and suggesting some improvements?

sarah11918 commented 3 weeks ago

Just pinging this for freshness in case anyone is interested in taking this on!