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

Does not work with createSSRApp #1376

Closed
danelowe opened this issue Mar 9, 2021 · 1 comment
Closed

Does not work with createSSRApp #1376

danelowe opened this issue Mar 9, 2021 · 1 comment

Comments

@danelowe
Copy link

danelowe commented Mar 9, 2021

Version

6.0.0-beta.7

Browser and OS info

Firefox 86.0 / macOS 11.1

Steps to reproduce

Download https://github.com/vitejs/vite.git and cd to packages/playground/ssr-vue

run npm i vite, then npm run dev. Open localhost:3000 in browser and try to use vue-devtools.

What is expected?

Vue devtools shows an app running on localhost:3000

What is actually happening?

Vue devtools shows 'No App' in the app selector.

Errors in console:

Uncaught (in promise) TypeError: record.rootInstance is null
    registerAppJob moz-extension://a954018d-dafd-ae48-aeca-7157f39e6cca/build/backend.js:1437
    registerApp moz-extension://a954018d-dafd-ae48-aeca-7157f39e6cca/build/backend.js:1403
    run moz-extension://a954018d-dafd-ae48-aeca-7157f39e6cca/build/backend.js:4373
    queue moz-extension://a954018d-dafd-ae48-aeca-7157f39e6cca/build/backend.js:4379

If you open up main.js in the example project and change the code to use createApp, devtools will work.

import App from './App.vue'
import { createApp as _createApp } from 'vue'
import { createRouter } from './router'

// SSR requires a fresh app instance per request, therefore we export a function
// that creates a fresh app instance. If using Vuex, we'd also be creating a
// fresh store here.
export function createApp() {
  const app = _createApp(App)
  const router = createRouter()
  app.use(router)
  return { app, router }
}

There are mentions of this at #1289, but that issue seemed to have been closed due to a flood of comments from people using Vue 2.

This issue is also present when using chrome, and when using standalone vue-devtools app.

@danelowe
Copy link
Author

danelowe commented Mar 9, 2021

Based on #1289 (comment), I added a workaround.

const instance = app.mount(rootContainer, true)
app._container._vnode = instance.$.vnode

@Akryum Akryum added the v6 label May 30, 2021
Akryum added a commit to vuejs/core that referenced this issue Jun 7, 2021
@Akryum Akryum closed this as completed in 82d4683 Jun 7, 2021
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

No branches or pull requests

2 participants