next.js
2404b90e - fix: try/catch access to localStorage within __NEXT_APP_ISR_INDICATOR useEffect (#72362)

Commit
1 year ago
fix: try/catch access to localStorage within __NEXT_APP_ISR_INDICATOR useEffect (#72362) ### What? Under certain circumstances, the Storage APIs, such as local storage, are not available. For example, the Brave browser allows users to block `all cookies`, which forbids access to local storage. - https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage#securityerror ### Why? When access to local storage fails, the development mode page crashes, leading to the `Application Error` view. ### How? Wrap on a try/catch the local storage access done within a use-effect, under `__NEXT_APP_ISR_INDICATOR`. There is another local storage access point, but that one is done as part of `processMessage`, which is called within a `try/catch` block already. Fixes #72046 Co-authored-by: JJ Kasper <jj@jjsweb.site>
Author
Parents
Loading