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

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

Closed
1 task
marpe opened this issue Oct 23, 2024 · 2 comments
Labels
needs triage Issue needs to be triaged pkg: vue Related to Vue (scope)

Comments

@marpe
Copy link

marpe commented Oct 23, 2024

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:

element.addEventListener('astro:unmount', () => app.unmount(), { once: true });

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

  • 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 Oct 23, 2024
@ematipico ematipico added the pkg: vue Related to Vue (scope) label Oct 23, 2024
@bluwy
Copy link
Member

bluwy commented Oct 25, 2024

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 added a commit that referenced this issue Oct 31, 2024
@bluwy
Copy link
Member

bluwy commented Oct 31, 2024

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

@bluwy bluwy closed this as completed Oct 31, 2024
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 pkg: vue Related to Vue (scope)
Projects
None yet
Development

No branches or pull requests

4 participants
@ematipico @marpe @bluwy and others