Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

claytonrcarter
Copy link
Contributor

1️⃣ Is this something that is wanted/needed? Did you create an issue / discussion about it first?

Issue exists at #2498, but appears to be larger than what is reported there. I ran into this while playing w/ LW and trying to use @click="$wire.emitUp('sortBy', 'column_name'). This caused a this.componentsListeningForEventThatAreTreeAncestors is undefined error. Changing to $wire.emit changed the error to this.listeners.call is undefined, as noted in #2498, and $wire.emitTo was causing this.getComponentsByName is undefined. Basically, this was being bound incorrectly when forwarding these calls to the store. This change corrects that by removing the .apply(component, args) code and simply calling those methods directly on the store via store[property](...args).

Also, it seems that emitUp should be receiving special handling like emitSelf (because it needs to receive the component element), but wasn't, so I have added a case to handle that.

Please note that this is my first PR here, and I've only been using LW for ~1 week, so I may just be me misunderstanding things, but this change was enough to get me up and running again w/ $wire.emit, $wire.emitUp and $wire.emitTo.

2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.

No, all of this code was needed to getting $wire.emit* working.

3️⃣ Does it include tests, if possible? (Not a deal-breaker, just a nice-to-have)

Yes. I have added a dusk test to do a basic check of each of the $wire.emit* methods. Before this change, only $wire.emitSelf appears to be working. W/ this change, all of the $wire.emit* methods are working.

Please note that I've only tested this in Safari as I can't seem to get Chrome to work w/ Dusk.

4️⃣ Please include a thorough description of the improvement and reasons why it's useful.

Check: see 1️⃣ 😄

5️⃣ Thanks for contributing! 🙌

Thank you for Livewire!

@claytonrcarter
Copy link
Contributor Author

Sorry, sort of a n00b regarding JS packages, Dusk tests and GH Actions. Am I supposed to commit the results of npm run build?

I assumed that those would be regenerated, but it looks like the tests are failing b/c they're being run against the versions in dist, which don't include my changes. Please advise.

@claytonrcarter
Copy link
Contributor Author

For those playing along at home, it looks like other PRs here are committing the build artifacts, so I've just pushed a commit that includes them here as well. Hope that's correct; easy to revert if not.

@calebporzio calebporzio merged commit 2495387 into livewire:master Apr 4, 2021
@calebporzio
Copy link
Collaborator

Thanks so much for this @claytonrcarter! And for the thorough tests!

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

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.