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

Conditionally apply data-astro-reload property #11324

Closed
1 task done
alator21 opened this issue Jun 24, 2024 · 3 comments
Closed
1 task done

Conditionally apply data-astro-reload property #11324

alator21 opened this issue Jun 24, 2024 · 3 comments
Labels
needs triage Issue needs to be triaged

Comments

@alator21
Copy link

Astro Info

Astro                    v4.10.2
Node                     v20.11.0
System                   Linux (x64)
Package Manager          bun
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind
                         @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I have an astro component with the following code

---
const items: Array<{ text: string; route: string; fullReload?: boolean }> = [
  {
    text: 'Documents',
    route: '/documents/',
    fullReload: true
  },
  { text: 'About', route: '/about' }
];
---
<ul>
    {
      items.map((item) => (
        <li>
          <a
            href={item.route}
            data-astro-reload={item.fullReload ? 'true' : undefined}>
            {item.text}
          </a>
        </li>
      ))
    }
  </ul>

I want some of my routes to have the property data-astro-reload so they can avoid some issues that i have with view-transitions.

When running astro check I get a warning

warning astro(2005): The data-astro-reload attribute does not accept a value
                 data-astro-reload={item.fullReload ? 'true' : undefined}

What's the expected result?

To not have any warning when having conditional data-astro-reload property

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-eyffq4?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jun 24, 2024
@matthewp
Copy link
Contributor

This was fixed in 2.8.1 of the compiler (it's possible your project doesn't have this yet).

@matthewp
Copy link
Contributor

This should be fixed in 4.11.1. Let me know if its not (releasing now). #11297

@alator21
Copy link
Author

Just upgraded to 4.1.1

Astro                    v4.11.1
Node                     v20.11.0
System                   Linux (x64)
Package Manager          bun
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind
                         @astrojs/react

The issue still persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants