Fix pat-search when providing URL parameters#1539
Conversation
6aaaa9f to
bcb8e17
Compare
bcb8e17 to
2e1dcc5
Compare
| clearTimeout(timeout); | ||
| timeout = setTimeout(search, 200); | ||
| }; | ||
| const searchDelayed = patUtils.debounce(search, 200); |
| ([key]) => key !== "ajax_load" && !formParams.has(key) | ||
| ) | ||
| ); | ||
| formParams.forEach((value, key) => params.append(key, value)); |
There was a problem hiding this comment.
I had to look up why the forEach reverses (key, value) here, but it is correct: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/forEach
This is so JavaScript 🙄
| // any key managed by the form to avoid duplicates | ||
| const params = new URLSearchParams( | ||
| [...new URLSearchParams(window.location.search)].filter( | ||
| ([key]) => key !== "ajax_load" && !formParams.has(key) |
There was a problem hiding this comment.
Not sure, why we would exclude ajax_load also...? But I guess you will have your reasons...
There was a problem hiding this comment.
since we're adding ajax_load to the url here https://github.com/plone/mockup/blob/fix-search-pattern/src/pat/search/search.js#L69-L73 we would get multiple ajax_load on every click if it's not removed here.
There was a problem hiding this comment.
we could eventually get rid of ajax_load, because of the new auto ajax check (in http headers) in Plone 6.2 ?
There was a problem hiding this comment.
Hm ... the new configuration plone.use_ajax_main_template is False per default ... so lets go with ajax_load here for now.
2e1dcc5 to
29d903f
Compare
Closes plone/Products.CMFPlone#3730