You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Investigate how to prevent component initialisation based on a condition, like Analytics needing users to have accepted cookies on the Design System site.
Why
This would offer a consistent way to initialise components that require a little check before actually being initialised, without having to actually instantiate them.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
We've designed the feature
We've implemented the feature
We've documented the feature
The text was updated successfully, but these errors were encountered:
romaricpascal
changed the title
[Stretch] Allow createAll to skip initialising components based on conditions (eg. Analytics and having accepted cookies)
[Stretch] Investigate how to prevent component initialisation based on a condition
Aug 9, 2024
Having a separate method to check if specific APIs are supported overlaps a lot with isSupported, made @protected in #5323. We've decided to merge the two approaches and make checkSupport static and protected, which will allow it to:
be called by createAll ahead of looping on all components, saving unnecessary looping
be overridden by child classes if a component or components have other conditions to check, like the availability of an API.
Child classes overriding the method will be able to throw whatever Error they see fit when support is not available for the component, which:
reduces the logistics the base class needs to be responsible for
allows child classes to send a custom message
will fit into createAll's way of catching these errors during initialisation
makes use of JavaScript's native capabilities for throwing errors rather than returning a boolean, then having the base class throw an error.
What
Investigate how to prevent component initialisation based on a condition, like Analytics needing users to have accepted cookies on the Design System site.
Why
This would offer a consistent way to initialise components that require a little check before actually being initialised, without having to actually instantiate them.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
The text was updated successfully, but these errors were encountered: