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

Fix <Head> vNode handling in Vue 3 adapter #1570

Merged
merged 3 commits into from
May 30, 2023
Merged

Fix <Head> vNode handling in Vue 3 adapter #1570

merged 3 commits into from
May 30, 2023

Conversation

craigrileyuk
Copy link
Contributor

Improved node detection process for Head component which now supports fragments, conditionals and functional components. Comments nodes are now automatically discarded.

Improved node detection process for Head component which now supports fragments, conditionals and functional components. Comments nodes are now automatically discarded.
@reinink
Copy link
Member

reinink commented May 29, 2023

@craigrileyuk Hey I really appreciate you tackling this! This looks good, although a plain <title> tags no longer work:

<Head>
  <title>Home</title>
</Head>

Is there a reason you're excluding nodes with children, here?

else if (!isComment && !node.children) return node

Could this just be this?

else if (!isComment) return node

@craigrileyuk
Copy link
Contributor Author

craigrileyuk commented May 29, 2023

Could this just be this?
else if (!isComment) return node

@reinink Yep. That fixes the <title> issue. I was trying to get the head node resolution to work with full SFCs and I think that one line was a holdover I forgot from that. Unfortunately, I couldn't get it to play nice with SSR, so I dropped it.

@reinink
Copy link
Member

reinink commented May 29, 2023

Okay great, I'll get this merged in and released. I'll probably tweak the code formatting a little to match what we normally do in this project, but really appreciate you doing the hard work here! 🙏

Unfortunately, I couldn't get it to play nice with SSR, so I dropped it.

Well, thanks for trying either way 😊

@reinink
Copy link
Member

reinink commented May 30, 2023

@craigrileyuk I've tweaked the formatting here to try and simplify things — I think everything still functionally works the same, but feel free to review 😊

@reinink reinink merged commit b285a91 into inertiajs:master May 30, 2023
@reinink reinink changed the title [vue3]: Backwards compatible vNode detection for head Fix <Head> node handling in Vue 3 adapter May 30, 2023
@reinink reinink changed the title Fix <Head> node handling in Vue 3 adapter Fix <Head> nVode handling in Vue 3 adapter May 30, 2023
@reinink
Copy link
Member

reinink commented Jun 9, 2023

This fixed has been released as part of v1.0.8 👍

@reinink reinink changed the title Fix <Head> nVode handling in Vue 3 adapter Fix <Head> vNode handling in Vue 3 adapter Jun 9, 2023
@craigrileyuk craigrileyuk deleted the craigrileyuk-patch-1 branch June 10, 2023 02:27
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 this pull request may close these issues.

2 participants