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

Error on using mingle inside nested Components #37

Closed
renky opened this issue Jan 23, 2025 · 3 comments
Closed

Error on using mingle inside nested Components #37

renky opened this issue Jan 23, 2025 · 3 comments

Comments

@renky
Copy link

renky commented Jan 23, 2025

Hi @ijpatricio

still using your great package and indeed in more and more complex situations

Currently I try to use wire-elements/modal package to load livewire-components inside a page-modal dialog. Btw.. another great package:
https://github.com/wire-elements/modal

in my situation i now try to load a mingle inside such a dialog, and now opening up the dialog, i run into an error

Alpine Expression Error: Cannot read properties of undefined (reading 'Elements')

Expression: "
        window.Mingle.Elements['resources/js/mingles/ImageEditor/ImageEditor.js']
            .boot(
                'mingle-8pETZDDEP3JJDXRz',
                '8ZcNRUaoUWhHF4MKXieP',
            )
    "

I also already dived into it and indeed it is because my component isn't correct registered inside window.mingle.Elements. This seems to be because inside the Dialog-Component - which is a nesting of components - the mingle.stack-script isn't called

@push(config('mingle.stack'))
    @vite($this->component())
@endpush

and indeed I can solve this issue, by just doing that manually.

  • when i add this code to my parent component that is loaded on page-load
@push(config('mingle.stack'))
    @vite('resources/js/mingles/ImageEditor/ImageEditor.js')
@endpus

it works perfectly fine...

so now the question is: do you have any idea how to solve that automatically? Livewire seems just to ignore this script-loading-information on loading the nested component

@ijpatricio
Copy link
Owner

Hmm there is a way for sure, loading such a script in deferred, just when the modal opens.

The easy fix is like you did, pre-loading manually on the parent.

Potentially, in a future, I can add such thing.

The current situation is that I don't want to add more features until I finish the environment setup.

I want to have the playground ready, php tests, e2e tests, all of that in the package, before adding more and more stuff.

I will do that for sure, it just will take some time, as I'm working on this alone, in my free time, which hasn't been much lately :)

Your feedback has been amazing, the support replying to other issues as well, much appreciated ❤ thank you @renky

@ijpatricio ijpatricio mentioned this issue Feb 3, 2025
11 tasks
@ijpatricio
Copy link
Owner

I added the reference in #12 to revisit this, and add async loading. Thanks!

@renky
Copy link
Author

renky commented Feb 3, 2025

to be honest: i guess this one is solved already with the mingle-Blade-directive
I just saw it today but hadn't a chance to make the update in the project and trying to remove the calls... I guess it will solve the issue...

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