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

🐛 BUG: Compiler error when multiple <tr> are conditionally added (0.21.6) #2069

Closed
stephanbogner opened this issue Dec 1, 2021 · 3 comments · Fixed by withastro/compiler#191
Assignees

Comments

@stephanbogner
Copy link
Contributor

What version of astro are you using?

0.21.6

What package manager are you using?

npm

What operating system are you using?

Mac (Catalina 10.15.7)

Describe the Bug

Description

I wanted to make a table were two rows are included conditionally.
Weirdly, if I only have 1 that is conditionally added, it works.
When it's 2, it doesn't work.

It shows 500: Internal Error – Error: Uh oh, the Astro compiler encountered an unrecoverable error! Please open a GitHub issue using the link below. which is why I am here now 😬

❌ Doesn't work:

[...]
<table>
        <tbody>
            <tr>
                <td>Normal row 1</td>
                <td>Content</td>
            </tr>
            {
            true ? (
                <tr>
                    <td>Conditional row 1</td>
                    <td>Content</td>
                </tr>) : null
            }
            {
            true ? (
                <tr>
                    <td>Conditional row 2</td>
                    <td>Content</td>
                </tr>) : null
            }
        </tbody>
</table>
[...]

✅ Works (second conditional removed)

[...]
<table>
        <tbody>
            <tr>
                <td>Normal row 1</td>
                <td>Content</td>
            </tr>
            {
            true ? (
                <tr>
                    <td>Conditional row 1</td>
                    <td>Content</td>
                </tr>) : null
            }
        </tbody>
</table>
[...]

✅ Works also (first conditional removed)

[...]
<table>
        <tbody>
            <tr>
                <td>Normal row 1</td>
                <td>Content</td>
            </tr>
            {
            true ? (
                <tr>
                    <td>Conditional row 2</td>
                    <td>Content</td>
                </tr>) : null
            }
        </tbody>
</table>
[...]

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ykj1cj?file=src/pages/index.astro

@drwpow drwpow self-assigned this Dec 1, 2021
@drwpow
Copy link
Member

drwpow commented Dec 1, 2021

which is why I am here now 😬

You have come to the right place, friend! 😄 Will look into this.

@drwpow
Copy link
Member

drwpow commented Dec 1, 2021

PR opened! The reason for the error being present within <table> is because in the HTML spec there are somewhat-special rules for parsing markdown within that. And there was a minor bug with expressions within <table> context only.

@stephanbogner
Copy link
Contributor Author

PR opened! The reason for the error being present within <table> is because in the HTML spec there are somewhat-special rules for parsing markdown within that. And there was a minor bug with expressions within <table> context only.

Wow that was fast 🚀 – thanks! 🙏

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

Successfully merging a pull request may close this issue.

2 participants