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

Provide version that's Vue 3 compatible #300

Closed
sinner opened this issue May 14, 2020 · 39 comments
Closed

Provide version that's Vue 3 compatible #300

sinner opened this issue May 14, 2020 · 39 comments
Labels

Comments

@sinner
Copy link

sinner commented May 14, 2020

It Doesn't have compatibility with the Vue 3 beta version. When the plugin is loaded it throws an error:

  • Uncaught TypeError: Vue.extend is not a function
@LinusBorg
Copy link
Owner

Yeah. This is a Vue 2 plugin. I'll release a vue 3 compatible version in time.

@LinusBorg LinusBorg changed the title It Doesn't have compatibility with the Vue 3 beta version Provide version that's Vue 3 compatible May 14, 2020
@LinusBorg
Copy link
Owner

Sidenote: Depending on your usecase you might not need portal-vue anymore as Vue 3 has a basic Portal in core now, named <teleport />.

https://github.com/vuejs/rfcs/blob/master/active-rfcs/0025-teleport.md

@mariusa
Copy link

mariusa commented Jul 1, 2020

@LinusBorg

Sidenote: Depending on your usecase you might not need portal-vue anymore as Vue 3 has a basic Portal in core now, named <teleport />.

https://github.com/vuejs/rfcs/blob/master/active-rfcs/0025-teleport.md

Will you still provide a vue3 compatible version, or users wanting v3 will need to migrate code to teleport ? Would you kindly provide a migration guide?

@LinusBorg
Copy link
Owner

LinusBorg commented Jul 1, 2020

I'll provide a Vue 3 compatible version, as <teleport> doesn't offer everything that portal-vue does - but the former has none of the caveats/downsides of the latter as well.

So people who can use <teleport> for their usecase should do so.

@yoyoys
Copy link

yoyoys commented Jul 23, 2020

@LinusBorg teleport can't work with transition, this cause some transition(leave animate) broken.

@mariusa
Copy link

mariusa commented Jul 23, 2020

Instead of duplicating the effort, improving teleport would be better instead of porting portal-vue to vue3? Or maybe have teleport plugins.

As a developer, I'd also want one component which works well enough, instead of several, each having various downsides.

@LinusBorg
Copy link
Owner

LinusBorg commented Jul 23, 2020

Teleport is already designed to solve the 80% use case, not all of Portal-Vue. If that covers your needs, by all means use that.

Portal-Vue does a few more things that teleport doesn't, so if you need those 20%, use Portal-Vue.

As those 20% of additional use cases make up for 80% of portal-vue's weight, those will not make it into core.

I'll try and build the new version on top of teleport so there's no duplication going on.

@LinusBorg
Copy link
Owner

@LinusBorg teleport can't work with transition, this cause some transition(leave animate) broken.

That should.be addressed as a bug in the Vue 3 repo then.

@yoyoys
Copy link

yoyoys commented Jul 24, 2020

@LinusBorg teleport can't work with transition, this cause some transition(leave animate) broken.

That should.be addressed as a bug in the Vue 3 repo then.

I think this is not only a bug,
because teleport is DOM-based, it could not send any component to transition child, bug portal-target can be a good target.

@LinusBorg I'll try and build the new version on top of teleport so there's no duplication going on.

but this is a good idea :)

@LinusBorg
Copy link
Owner

LinusBorg commented Jul 24, 2020

because teleport is DOM-based, it could not send any component to transition child,

I'm not sure what you mean here.

I again suggest to try and open an issue about your problem in the Vue 3 Repo. I can tell you that I would expect this to work - and I wrote the RFC for <teleport>.

@anhoev
Copy link

anhoev commented Jul 28, 2020

Hi, do you have an exact plan for release a version for vue 3 ? And what is about performance for vue 3 version , i see the lack of performance by vue 2 version.
And i think about the consistent name with vue's teleport like teleport-slot , maybe is easier for developers to understand.
I think it is better if your full version can be intergrated in core, because the vue 3 has tree shaking .So the developers don't need to worry about the bundle size, and the core team can maintain it better. I see the big value by your plugin to decouple the code in some cases like widget or cms system. Maybe you can write a RFC to persuade the core team .

@loren138
Copy link

Following/joining, I have an issue with the portal target living as a sibling of the portal (portal sends content of the selected article to the sidebar), which isn't supported by teleport:

vuejs/core#992 (comment)

The target element cannot be a part of the same component... It needs to be outside of <div id="app">.

vuejs/core#1705 (comment)

[Vue warn]: Failed to locate Teleport target with selector ".cell2". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.

I'm pretty sure I could use some hacking to force vue to render the sidebar and then in the nextTick populate the articles so the teleport target exists before an article, but I'd rather the portal handle waiting an extra render cycle as this one does.

@LinusBorg LinusBorg pinned this issue Jul 31, 2020
@gigasource
Copy link

any update ?

@LinusBorg
Copy link
Owner

On it but got set back a bit as I broke my arm recently. coding is .... difficult right now ^^

Will def still be a few more weeks before I can publish something.

@joorce
Copy link

joorce commented Sep 18, 2020

Sorry to hear that. Get well soon.

@LinusBorg
Copy link
Owner

So, I'm well enough recovered to start working on the migration. It's going well so far, I'm a few missing tests away from udpating documentation.

If everythign goes as planned (which, let's be honest, it rarely does) I'll have a preview release ready sometime next week.

@LinusBorg
Copy link
Owner

Things of course go slower, but code and tests are now fully ported.

Left: Update docs, document breaking changes (few) and publish.

@cjblomqvist
Copy link

Sorry for bloating the thread, but I really wanted to point how examplary your communication is @LinusBorg - keeping everyone updated on the matter! Very few keep their users updated like this (and often leave you hanging for a long time until a big boom happens - if it ever does...). Inspiring!

@LinusBorg
Copy link
Owner

Oh I often fail at that as well :D

@ashbryant
Copy link

@LinusBorg I hope you're feeling better. Do you have an eta on this? I've tried using the new teleport feature of v3 but it seems you can only use it outside of the Vue DOM. Portal doesn't seem to have that limitation. Is that correct?

@ps73
Copy link

ps73 commented Jan 27, 2021

@LinusBorg Is there any progress on this issue?

@LinusBorg
Copy link
Owner

LinusBorg commented Jan 27, 2021

Yes, though it took longer than anticipated.

I have an alpha version ready, just need to publish. Preliminary docs are already up at https://next.portal-vue.linusb.org

I'm in the middle of preparing a talk, so will release the alpha on sunday after that. Can't take distractions right now.

@LinusBorg
Copy link
Owner

Missed my personal deadline for this weekend but I'll squeeze it in somewhere in the coming days.

@pertoyra
Copy link

@LinusBorg Sorry to bump this, have you had any time to look at this?

@LinusBorg
Copy link
Owner

silently published 3.0.0-alpha.0 in the next tag, feel free to check it out.

I'll do an announcement later.

Docs are preliminary and still need some work here and there, but the bulk should be usable.

@Botz
Copy link

Botz commented Jun 19, 2021

Currently i am trying to migrate a vue2 project to vue3, first i tried to use teleport, but i need the @change and :order functionality. so i found this one.
But now i am getting:
[Vue warn]: inject() can only be used inside setup() or functional components.
I use vue: 3.1.1 with vue-cli and not vite

The example from this repo works fine.

@LinusBorg
Copy link
Owner

LinusBorg commented Jun 20, 2021

@Botz Can you share any more details? With what you provided it's hard to check if/how this is related to this library/version.

If so, Please open a bug issue.

@tochoromero
Copy link

@LinusBorg I have the opposite issue with the "node" version, I'm stuck in node 12 and the plugins is requiring node 14.
Is there a technical reason for it?

@ghost
Copy link

ghost commented Sep 29, 2021

@LinusBorg I dug through the Vue 3 version a little. In the wormhole code, it looks like an entirely separate Vue app is being created. Is there a way to wormhole content within the consuming app? That would preserve things like global components and directives that users register and expect to still work when they pass them through the wormhole.

@LinusBorg
Copy link
Owner

I'm not sure what you are talking about exactly. There's no app being created.

@ghost
Copy link

ghost commented Sep 30, 2021

@LinusBorg A call to createApp happens in the mountPortalTarget utility method. If users want to programmatically wormhole content to document.body or insert it as a child of #app and still have directives and global components work properly, how is that possible without explicitly mounting <portal-target>? A good example use case would be building a library with a ToastManager and an app calling ToastManager.open(ToastComponent, { ...managerOptions}). Ideally such a manager would automatically mount a <portal-target> in the same app so that the toast content inherits global configuration, directives, etc. It would be nice to not require the app to explicitly import and mount a <portal-target> that's just going to be stuck on document.body.

@LinusBorg
Copy link
Owner

Oh, you are talking about that edge case where one might want to use portal-vue instead of <teleport>? That indeed uses a separate app instance, yes.

We could likely make the new instance share the current app's components and directives as well - we already do it for the provide's. Feel free to open a feature request as a reminder for me.

@yannbanvi-zz
Copy link

Thanks a lot @LinusBorg , though teleport is built now in vue 3, I was stuck when using inertia with laravel. I was using persistent layout and wanted to have multiple slots in parent so children can inject whatever they want. As for now there is no support for multiple slots when using persistent layout in inertia. Also teleport could not make it happen for me as it was made for scenarios where we would like to teleport content outside of the App hierarchy but somewhere else in the DOM. So your alpha version of portal-vue sort it out for me. Many thanks.

@whitespacecode
Copy link

Thanks a lot @LinusBorg , though teleport is built now in vue 3, I was stuck when using inertia with laravel. I was using persistent layout and wanted to have multiple slots in parent so children can inject whatever they want. As for now there is no support for multiple slots when using persistent layout in inertia. Also teleport could not make it happen for me as it was made for scenarios where we would like to teleport content outside of the App hierarchy but somewhere else in the DOM. So your alpha version of portal-vue sort it out for me. Many thanks.

Having the same issue this alpha package made it super easy! Many thanks for the vue3 update

@jaredthirsk
Copy link

FYI there is another Vue 3 effort here:

https://github.com/VasekProchazka/vue3-portal

@sneakylenny
Copy link

sneakylenny commented Aug 2, 2022

Installing version 3.0.0-beta.0 works fine for me

Can be installed using next tag btw

@TDola
Copy link

TDola commented Nov 7, 2022

Any update on this? I am going through all our tech debt before moving to Vue 3 and this plugin could be a blocker.

@LinusBorg
Copy link
Owner

Yeah need to get around to just publishing this as 3.0, there won't be any changes.

@dschmidt dschmidt mentioned this issue Nov 12, 2022
29 tasks
@dschmidt
Copy link

3.0.0 final is released, I assume this can be closed?

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