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

Weird bug causing portal component losing all states & refs #159

Closed
nodegin opened this issue Nov 22, 2018 · 4 comments
Closed

Weird bug causing portal component losing all states & refs #159

nodegin opened this issue Nov 22, 2018 · 4 comments
Labels

Comments

@nodegin
Copy link

nodegin commented Nov 22, 2018

See the bug in action

This seems is a portal-vue internal bug, currently I am using the display hack as workaround.

In case codesandbox link dead:
vue-portal-slots.zip

@nodegin
Copy link
Author

nodegin commented Nov 22, 2018

Another interesting behavior: if you edit Vuex store state smallScreen to true

The bug will be deferred for 1 tick

demo

@nodegin nodegin changed the title Weird bug causing portal component lost all states & refs Weird bug causing portal component losing all states & refs Nov 22, 2018
@LinusBorg
Copy link
Owner

Hm, interesting.

My first suspicion would be that the same vnodes are re-used when switching from one portal-target to the other, but since they were already used to be mounted in the first target, they don't work correctly in the second one.

But if that was the case, a scoped slot instead of a normal one should solve it, but doesn't either.

Will look into it further.

@LinusBorg
Copy link
Owner

Hey @nodegin I just published 1.5.1-beta.0, you can install it with the next tag:

npm i portal-vue@next

Please test this version and report back if your issue is fixed - it should be.

@LinusBorg
Copy link
Owner

Nevermind, this path release won't fix it either. In fact, after taking a second look I think there's not much we could do.

In the part of your example that is the "bug", you are, by using v-if, destroying the portal and all of its children - which included the stateful component.

And in the other target that you are switching to, the component has to be re-created.

There isn't really anything we can do about this, I think. Sorry.

@LinusBorg LinusBorg added invalid and removed bug labels Dec 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants