-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add decision record about JavaScript browser compatibility #25
Conversation
0df8c3a
to
b5a86f8
Compare
b5a86f8
to
0414f02
Compare
7a451f4
to
1014c34
Compare
2ec3d17
to
5a296f8
Compare
@colinrotherham I've updated the record based on your feedback. @claireashworth please let me know if there's any content updates to make before we can merge it 😊 |
|
||
Using a dynamic `import()` call would allow to handle syntax errors when parsing GOV.UK Frontend (via a `.catch` on the promise, or a `try/catch` block, depending on the browsers you'd want to support). | ||
|
||
This complicates the integration for services as it requires more JavaScript knowledge to understand which piece of code will run or not if GOV.UK Frontend fails to parse. It also complicates the import of multiple individual components, requiring to make sure the `import()` calls run in parallel to not hinder performance (on top of the individual components not being discoverable by [the browsers' preload-scanner](https://web.dev/preload-scanner/)), but handle the potential failure of these calls appropriately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to mention the opposite?
That as our JavaScript takes longer and longer to run, we'll delay the initialisation of components that run last (as they get queried, looped and have init()
run)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "the opposite"? I'm sure I understand what leads to "our JavaScript takes longer and longer to run" (only thing I come to mind is the growing number of transformations that will make our file size grow).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I was commenting on "import()
calls run in parallel"
As in, do we need to comment on "the opposite" benefits of Promises?
- By supporting sequential
.init()
, we can simplify integration by avoiding Promises - By supporting concurrent
.init()
, we can avoid render blocking from slowforEach()
Or shall we remove anything that can be moved to an API decision record?
5a5aa59
to
84e0f3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on how light our previous decisions were, I'm sure a few sections could be reduced to fewer words. But otherwise, looks good to me
fc42b93
to
5122ce9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ace, thanks for making those last few changes ❤️
146d21b
to
2698730
Compare
Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk> Co-authored-by: Colin Rotherham <colin.rotherham@digital.cabinet-office.gov.uk>
2698730
to
c016c51
Compare
This records the decision following this week's discussion where we settled on what our approach would be to ensure how we'll make our JavaScript compatible with the browsers we set out to support