Matomo Endless Loop after user has revoked consent

I am getting an endless loop, after a user that has revoked his consent and tries to renew the consent.

This error can be spotted when looking at the ‘setConsentCookie’ method in the piwik.js (https://github.com/matomo-org/matomo/blob/b58a33309e86358a99083f34abfd543c76c6e80b/js/piwik.js#L7252C1)

In this method a for loop exists that iterates over the content of ‘consentRequestsQueue’.
However inside the loop the ‘sendRequest’ might be called which leads to this line (https://github.com/matomo-org/matomo/blob/b58a33309e86358a99083f34abfd543c76c6e80b/js/piwik.js#L3158) where the request is pushed into the queue when the user has not given consent.

This grows the queue infinitely and the for loop never terminates causing the browser to hang.