-
Notifications
You must be signed in to change notification settings - Fork 65
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
Multiple extensions that modify the parameters cannot be used together #145
Comments
Hey, what you described is correct ; htmx will only care about the first extension that can process parameters With the current implementation, Seems it's been working like that since the beginning, not sure if that was intended though You could work around it using a
Hope this helps! |
Hey @Telroshan! I've been able to implement a workaround as you suggested, and right now it seems to work fine. (I simply added a name to the object and then checked for it) In order to fix these kinds of issues (filter the extensions within an extension) and to avoid introducing breaking changes, something that we could do is allow Even though I'm not very sure this adds any value to htmx, since I'm the only one experiencing the "issue", do you think it is something worth pursuing? or should I close the issue right here? Thank you for the help! |
I would personally be in favor of making the internal API more flexible to let people achieve what they want with it.
Bruh that's literally what you said, seems I have reading issues this morning! |
I've just opened the PR! |
I've implemented my own extension that merges the hx-vals from other elements to the current one
The problem is that when using it together with other extensions (in this case json-enc-custom) that modify too the parameters, it seems that only one of the extensions works
This is how I've implemented my extension
Then I thought of some sort of workaround and I added this to the extension
The problem is that withExtensions calls getExtensions and it gets all the extension from the element (included my extension), which causes an infinite loop and it is not possible right now to ignore extensions from withExtensions
Is there another way to do this? (Pipe down the result of encodeParameters to multiple extensions) or am I doing something wrong?
PS:
The result of the encoded parameters depends on the order in which the extensions are called
e.g. when using
hx-ext="json-enc-custom,merge-vals"
only json-enc-custom worksThe text was updated successfully, but these errors were encountered: