mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
6bd1806650
refs https://ghost.slack.com/archives/C02G9E68C/p1647599592576139 refs https://ghost.slack.com/archives/C02G9E68C/p1647620250625909 Issue: `Cannot destructure property 'fromRegex' of 'this.redirectsredirectId]' as it is undefined.` is being thrown, only when running all tests. Cause: duplicate redirects are added to a redirectManager, and not cleared correctly in the redirectManager, which throws an error when removing one of the duplicate redirects. Because the same redirectManager is used, multiple event listeners are connected to the same redirectManager. So when the offer service has been initialised multiple times, multiple listeners are added, which create a redirect for every newly created offer... to the same redirectManager. So there are three possible fixes for the same problem (would be best to fix them all): - Create a new redirectManager every time the offer service is initialised - Figure out a way to remove DomainEvents subscribers between tests - Don't add the same redirect id multiple times to redirectIds in addRedirect from the express-dynamic-redirects package This commit contains a fix for the first solution. It also moved the offers service initialising before the frontend (to `initServicesForFrontend`) |
||
---|---|---|
.. | ||
index.js | ||
service.js |