PageRenderer addJsLibrary and addJsFooterLibrary add the same file multiple times
These two functions contain an invalid (always true) condition before adding the JS to the internal file array.
All other similar functions already hold a correct condition.
I suggest making those API function behave identical - as the current code would suggest already.
Updated by Gerrit Code Review about 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64897
Updated by Jonas Eberle 12 months ago
Actually the current code did not always add a new entry, but would overwrite an existing entry with the same `name` if it existed already. It would only add new entries if the `name` changed.
So although the condition had a logical error and was always true, it behaved correctly and as expected because it allowed to overwrite an already registered asset. This btw. is the behaviour, that the AssetCollector uses, too.
In my opinion there was no bug here.
I still suggest as in my comment in the review to rather remove the condition completely. I might have been hard to understand but I firmly believe that this would be the only non-breaking way.