Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(vue 3): update the implementation of createServerRootMixin #1020

Merged
merged 5 commits into from
Jul 20, 2021

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jul 16, 2021

Summary

This PR updates the implementation of createServerRootMixin.
It excludes the test cases for vue 3 about forwarding $root and $slots. I haven't figured it out, and if it's really necessary, etc.

I will try it out separately and if so, I'll probably do it in a separate PR as a fix (because I don't think I'll do it immediately).


It's normal that the CI doesn't pass here. It's fixed in #1021 because

feat/vue3-compat
  ㄴ test: update tests compatible for both vue 2 and vue 3 [1/2] #1014
    ㄴ this PR
       ㄴ  test: update tests compatible for both vue 2 and vue 3 [2/2] #1021

However once it's approved, I will rebase this and merge it as an individual commit to feat/vue3-compat (not mixing with the "update tests" PRs).

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 16, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2ae5bf7:

Sandbox Source
vue-instantsearch-e-commerce Configuration

let router;
if (isVue3) {
const Router4 = require('vue-router4');
router = Router4.createRouter({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

↑ minimal amount of code to create a router that works with no error.


// there are two renders of App, each with an assertion
expect.assertions(2);

const App = Vue.component('App', {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have to be a registered component.

src/util/createServerRootMixin.js Show resolved Hide resolved
// At this point, we don't even have the definition of the props.
// So we cannot pass exactly the propsData only.
// FIXME: Maybe we need to get the list of props in `createServerRootMixin`.
app = createSSRApp(appOptions, _objectSpread({}, componentInstance));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may change the signature of createServerRootMixin for vue 3, but needs more real life examples to verify.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you expect to be solved in the fixme before merging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure. We could merge this as-is and I can make some examples to see how they act in real life, and later come back with a solution.

src/util/createServerRootMixin.js Outdated Show resolved Hide resolved
src/util/createServerRootMixin.js Show resolved Hide resolved
@eunjae-lee eunjae-lee added this to the Vue 3 milestone Jul 16, 2021
@eunjae-lee eunjae-lee marked this pull request as ready for review July 19, 2021 11:47
@eunjae-lee eunjae-lee requested review from a team, tkrugg, shortcuts and Haroenv and removed request for a team July 19, 2021 11:51
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall these changes look like the wouldn't break vue 2

src/util/createServerRootMixin.js Show resolved Hide resolved
// At this point, we don't even have the definition of the props.
// So we cannot pass exactly the propsData only.
// FIXME: Maybe we need to get the list of props in `createServerRootMixin`.
app = createSSRApp(appOptions, _objectSpread({}, componentInstance));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you expect to be solved in the fixme before merging?

src/util/createServerRootMixin.js Show resolved Hide resolved
src/util/createServerRootMixin.js Outdated Show resolved Hide resolved
Base automatically changed from fix/v3-compat-tests to feat/vue3-compat July 20, 2021 09:42
@eunjae-lee eunjae-lee changed the base branch from feat/vue3-compat to fix/v3-compat-tests July 20, 2021 09:44
@eunjae-lee eunjae-lee changed the base branch from fix/v3-compat-tests to feat/vue3-compat July 20, 2021 13:14
@eunjae-lee eunjae-lee merged commit 684ba11 into feat/vue3-compat Jul 20, 2021
@eunjae-lee eunjae-lee deleted the fix/v3-compat-ssr branch July 20, 2021 13:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants