ijpatricio / mingle

Use JS components with Vue or React in a Laravel Livewire and/or Filament application
MIT License
205 stars 6 forks source link

Cannot include more than one component in the same view #6

Closed andruu closed 2 months ago

andruu commented 2 months ago

Trying to include 2 components on the same view.

CleanShot 2024-04-15 at 15 20 02@2x

Abdallah-Tah commented 2 months ago

I am getting the same issue.

ijpatricio commented 2 months ago

Hey @andruu @Abdallah-Tah

You mean 2 Mingles, right? meaning 2 Livewire classes?

I'll check tomorrow morning and let you know.

Thanks for the feedback 👍

ijpatricio commented 2 months ago

Tomorrow I'll double check all scenarios. Just wanted to be sure your scenario.

2 instances of the same base component (e.g.: 2 instances of resources/js/Foo.js)

or

1 instance of "Foo" and 1 instance of "Bar"??

andruu commented 2 months ago

Including 2 mingle components on the same page

Felipe-DevT00ls commented 2 months ago

Has anyone managed to resolve this problem?

ijpatricio commented 2 months ago

I'm having a look today

Felipe-DevT00ls commented 2 months ago

What causes the error as reported above is the use of two Livewire components with MingleJS, as shown in the image below:

image Well, I did some tests and realized that it's not possible to have two independent livewires mingleJs regardless of the chosen stack. Whether it's React + React or React + Vue or Vue + Vue, any combination will cause an error.

As already reported above, in the devtools it is possible to see that the error is in the boot of the second windows.Mingle.Elements, only the first one is properly stored and it is possible to occur the boot.

image

ijpatricio commented 2 months ago

Thank you for the analysis.

I'm able to change that, don't worry.

In the proof of concept, I put 3 mingles on the same page, 2 Vue e 1 React, for example.

https://github.com/ijpatricio/minglejs-demo/blob/main/resources/views/vue-composables.blade.php

image

This is perfectly viable, I'll change it.

Felipe-DevT00ls commented 2 months ago

Great. I eagerly await the correction

ijpatricio commented 2 months ago

Hey everyone.

This is fixed in v0.0.14 which is available now.

I'll release today the demo, if I have time, if not, tomorrow.

image

ijpatricio commented 2 months ago

Hey all,

I still didn't announced, but it's released 🎉

https://minglejs-demo.unitedbycode.com

Thanks for the support!!