naja-js / naja

Modern AJAX library for Nette Framework
https://naja.js.org
MIT License
109 stars 15 forks source link

Respect preset unique #375

Closed SendiMyrkr closed 7 months ago

SendiMyrkr commented 1 year ago

I think that should be better to have check if unique is not set already. Because there is no possibility to force unique group or disable directly from JS. Or do i missing something?

https://github.com/naja-js/naja/blob/main/src/extensions/UniqueExtension.ts#L23

jiripudil commented 1 year ago

Hi, yes, nice catch, thanks! Other components of Naja only overwrite their respective option if the element has an explicit attribute. It seems it's omitted in this extension by mistake.

Would you care to send a PR? It should suffice to wrap the code in a similar condition to the one in AbortExtension. I'll put it in my backlog otherwise :)

SendiMyrkr commented 1 year ago

What about this solution?