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

fix(live): fix testing events #1113

Merged
merged 1 commit into from
Sep 19, 2023
Merged

fix(live): fix testing events #1113

merged 1 commit into from
Sep 19, 2023

Conversation

kbond
Copy link
Member

@kbond kbond commented Sep 13, 2023

Q A
Bug fix? yes
New feature? no
Tickets Fix #1110
License MIT

When implementing #823, I made the wrong assumption that events were identical to actions. This fixes that.

throw new \InvalidArgumentException(sprintf('Event "%s" does not exist on component "%s".', $event, $this->metadata->getName()));
}

return $this->request(['actions' => $actions], '_batch');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor, and it shouldn't make any difference, but if we have just one action, it won't process through batch: it'll just call that one action directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The js makes this distinction?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. The js always tries to use the normal endpoint (either for calling a LiveAction or the "default" action in the case of a re-render). If it finds that it has 2 things queued at once, then it goes through batch. https://github.com/symfony/ux/blob/2.x/src/LiveComponent/assets/src/Backend/RequestBuilder.ts#L71-L79

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll match in the helper.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has been made.

@weaverryan
Copy link
Member

Thanks Kevin!

@weaverryan weaverryan merged commit 976b53f into symfony:2.x Sep 19, 2023
38 checks passed
@kbond kbond deleted the live-test-emit branch September 20, 2023 17:11
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.

[LiveComponent] 2.11 - Testing an emit fails because of the event name being used for the method
2 participants