Skip to content

Introduces transition:reload instead of data-astro-reload#6856

Closed
martrapp wants to merge 1 commit into
mainfrom
mt/reload
Closed

Introduces transition:reload instead of data-astro-reload#6856
martrapp wants to merge 1 commit into
mainfrom
mt/reload

Conversation

@martrapp
Copy link
Copy Markdown
Member

Description (required)

Background:

Since version 3.0.0 you can use data-astro-reload to disable view transitions for certain links.
At first this was for <a> tags, but then it was extended to <form>, <area> and <svg> anchors.
withastro/astro#9977 now also introduces data-astro-reload for <script> tags to allow users to mark scripts for re-execution during view transitions.

Astro only has a few places where it relies on data-astro-* attributes. These are typically for low-level techniques or implementation details. Most of the time Astro uses xyz:* directives to control things. These look more official and, more importantly, they have better compiler and language tool support.

This PR ...

documents the transition:reload directive introduced by https://github.com/withastro/compiler/pulls that will replace data-astro-reload for the sake of better warning messages when misused and better language tool support.
data-astro-reload will still continue to work.

Related issues & labels (optional)

Documents compiler PR #965
Not sure yet what implication a compiler minor(?) has on Astro releases and docs.
This PR should be merged only after #6798 and compiler PR #965.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Feb 10, 2024 8:29pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
docs-i18n ⬜️ Ignored (Inspect) Feb 10, 2024 8:29pm

@sarah11918
Copy link
Copy Markdown
Member

Hi @martrapp !

If this is simply an alternative way of achieving the same thing, then we should probably document it as that: an alternative, and not replace the old documentation. Even if this way is "better", people will still have the old way in their projects, and people are notoriously bad at updating to the latest version. So, we can't have this as the only documented way when it simply will not work for a lot of people.

So, this becomes tricky from my perspective because we can NOT simply document what it is as "the way to do something", but in fact have to provide guidance on this as a replacement.

My suggestion would be to document this as if it were in fact a new thing, immediately after astro-data-reload like:

  • data-astro-reload: an <a> tag attribute to force a full-page navigation. Deprecated in Astro v4.x.0. Use transition: reload instead.
  • <Since 4.x.0 /> transition: reload: a directive for <a>, <area>, <form> and <script> tags to force a full-page navigation. Replaces astro-data-reload.

Does that give you enough to go on to reshape this a bit?

@sarah11918 sarah11918 added the merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) label Feb 13, 2024
@martrapp
Copy link
Copy Markdown
Member Author

We stay with data-astro-reload and introduce data-astro-rerun, see withastro/astro#9977

@martrapp martrapp closed this Feb 17, 2024
@martrapp martrapp deleted the mt/reload branch July 29, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants