When using LinkWrapper in a context that is prone towards reuse, you can end up with one link modifying another. For example, when used in a relationshipWidget, you can end up with search parameters being appended to search parameters being appended to search parameters, etc. We think the solution to copy the props to a reference, and make any alterations to said reference. If this works, we will post a patch shortly. Ta, Jake
Created attachment 194382 [details] [review] Bug 41976: LinkWrapper no longer mangles links This patch fixes a bug where, context-dependent, LinkWrapper can keep referencing back to links that should be out of scope. This was causing odd behaviour whilst writing Bug 14962 - namely, links returning as the same value in a table of multiple rows due to LinkWrapper treating linkData.href as one and the same for each row. TO TEST: == APPLY PATCH == a) enable ERMModule syspref, go to /cgi-bin/koha/erm/erm.pl b) notice all links and buttons still work as expected c) go to /cgi-bin/koha/sip2/sip2.pl d) notice all links and buttons still work as expected e) go to /cgi-bin/koha/acquisition/vendors f) notice all links and buttons still work as expected g) enable PreservationModule syspref, go to /cgi-bin/koha/preservation/home.pl h) notice all links and buttons still work as expected == SIGN OFF ==
Short bug, and quick SO/QA would be appreciated. Feel free to MM me a quid-pro-quo :-) Ta, Jake
Created attachment 194403 [details] [review] Bug 41976: LinkWrapper no longer mangles links This patch fixes a bug where, context-dependent, LinkWrapper can keep referencing back to links that should be out of scope. This was causing odd behaviour whilst writing Bug 14962 - namely, links returning as the same value in a table of multiple rows due to LinkWrapper treating linkData.href as one and the same for each row. TO TEST: == APPLY PATCH == a) enable ERMModule syspref, go to /cgi-bin/koha/erm/erm.pl b) notice all links and buttons still work as expected c) go to /cgi-bin/koha/sip2/sip2.pl d) notice all links and buttons still work as expected e) go to /cgi-bin/koha/acquisition/vendors f) notice all links and buttons still work as expected g) enable PreservationModule syspref, go to /cgi-bin/koha/preservation/home.pl h) notice all links and buttons still work as expected == SIGN OFF == Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. I've only done basic testing: making sure I can add, edit and delete things. 2. So may require more thorough testing by someone who knows what is actually being fixed here (sounds like it can be hard to reproduce). 3. After applying the patch: yarn build and restart_all