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

Prevent JsCallback chain to be evaluated twice #2150

Merged
merged 3 commits into from
Jan 30, 2024
Merged

Conversation

mvorisek
Copy link
Member

@mvorisek mvorisek commented Jan 30, 2024

Since the introduction - https://github.com/atk4/ui/blob/90b0fcecdc/src/jsCallback.php#L21 - the JS chain was allowed to be mutated (like $jquery->xxx()) and if so, it was automatically appended to the response.

But all usages and demos also return the JS chain!

This was a problem, as the returned JS chain was added to the response as well, so the JS chain was evaluated twice!

Now we fix it by no longer adding the JS chain to the response, instead, we require the JS chain to be returned it if it was mutated.

repro: https://github.com/atk4/ui/blob/5.0.0/demos/javascript/js.php#L60

before:

image

after:

image

@mvorisek mvorisek marked this pull request as ready for review January 30, 2024 22:34
@mvorisek mvorisek changed the title Prevent JsCallback chain to be returned twice Prevent JsCallback chain to be evaluated twice Jan 30, 2024
@mvorisek mvorisek merged commit 9f5104c into develop Jan 30, 2024
49 checks passed
@mvorisek mvorisek deleted the fix_js_callback branch January 30, 2024 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant