When we init nodes and find a "load" trigger it does the request straight away and this request may disable some elements with hx-disabled-elt. However if these disabled elements have not yet had their nodeInit() run yet because they are placed lower in the page then when they later init they first de-init their internalData which removes the requestCount counter used to re-enable them again. So we need it to handle situations where requestCount is not set and currently it defaults this to -1 and no 0 because of the decrement. So to solve this I've just changed it to fall back to 1 which means that if either requestCount is undefined or if it is equal to 0 it will replace it with 1 and then after the decrement will be 0 and trigger the proper code to enable the element again.
Corresponding issue:
2767
Testing
Wrote a test to reproduce the issue with disabled-elt and load together and did a quick test in my test project to prove the disabled button re-enables as expected.
Checklist
[x] I have read the contribution guidelines
[x] I have targeted this PR against the correct branch (master for website changes, dev for
source changes)
[x] This is either a bugfix, a documentation update, or a new feature that has been explicitly
approved via an issue
[x] I ran the test suite locally (npm run test) and verified that it succeeded
Description
When we init nodes and find a "load" trigger it does the request straight away and this request may disable some elements with hx-disabled-elt. However if these disabled elements have not yet had their nodeInit() run yet because they are placed lower in the page then when they later init they first de-init their internalData which removes the requestCount counter used to re-enable them again. So we need it to handle situations where requestCount is not set and currently it defaults this to -1 and no 0 because of the decrement. So to solve this I've just changed it to fall back to 1 which means that if either requestCount is undefined or if it is equal to 0 it will replace it with 1 and then after the decrement will be 0 and trigger the proper code to enable the element again.
Corresponding issue:
2767
Testing
Wrote a test to reproduce the issue with disabled-elt and load together and did a quick test in my test project to prove the disabled button re-enables as expected.
Checklist
master
for website changes,dev
for source changes)npm run test
) and verified that it succeeded