withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.81k stars 2.49k forks source link

Uncaught ReferenceError app is not defined when navigating between pages using view transitions and vue on v5.0.0-beta.5 #12289

Closed marpe closed 2 weeks ago

marpe commented 3 weeks ago

Astro Info

Astro                    v5.0.0-beta.5
Node                     v22.6.0
System                   Windows (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node ( "^9.0.0-beta.2" )
Integrations             @astrojs/vue ( "^5.0.0-beta.0" )

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

Chrome

Describe the Bug

I'm receiving a Uncaught ReferenceError: app is not defined error when navigating from a page with a vue component when using view transitions. Probably related to #12116. it's this line: https://github.com/withastro/astro/blob/52d1b58f89969551f881bc95107b5caf19d70586/packages/integrations/vue/client.js#L47

Note that I'm running the 5.0 beta.

Minimal repro here

08:49:38.734 router.js:117 A soft navigation has been detected: http://localhost:4322/other
08:49:39.400 router.js:117 A soft navigation has been detected: http://localhost:4322/
08:49:39.405 client.js:51 Uncaught ReferenceError: app is not defined
    at element.addEventListener.once (client.js:51:55)
    at HTMLDocument.<anonymous> (<anonymous>:1:2015)
    at triggerEvent (router.js:17:41)
    at updateDOM (router.js:198:3)
    at router.js:309:25
element.addEventListener.once @ client.js:51
(anonymous) @ VM1023:1
triggerEvent @ router.js:17
updateDOM @ router.js:198
(anonymous) @ router.js:309

What's the expected result?

I expect no error to be thrown :}

Link to Minimal Reproducible Example

https://github.com/marpe/astro-viewtransition-issue

Participation

bluwy commented 3 weeks ago

I think forcing another release for @astrojs/vue in the next branch should fix this. Interesting issue with changesets though as this means bug fixes from main won't trigger a release on next because we always do a release in main first (which clears the changesets) before merging up and releasing next 🤔

bluwy commented 2 weeks ago

Fixed in @astrojs/vue@5.0.0-beta.1