- 🇮🇹Italy FrancescoQ
I found some issues with the first provided approach:
- - only one provider could be set, as the last one overrides the previous ones.
- - there could be some issues in case of different js loading times, when the provider js file was loaded before the library.
with the attached patch I changed the way we provide/collect the cacheable cookie handling providers, by treating more in a similar way Drupal core use the behaviours:
- - They are now stored in "their own" Drupal property
cacheableCookieHandlingProviders
so there's no risk thatcacheableCookieHandling
in not initialised if the JS are loaded in different order. - - When
cacheableCookieHandling
init we search/loop that property and if we found some providers we use the provided data - - Before this change the last provider set in the
cacheableCookieHandling
object was the only one that could provide data since it overrides the old ones (we don't have a case of multiple providers yet, but this could happens), now all the providers are manteined.
I also provided an updated example with this new logic implemented.