Skip to content

Commit

Permalink
fix: remove event filename condition from initializer (#38)
Browse files Browse the repository at this point in the history
Fixes #36

---------

Co-authored-by: Miłosław Politowski <miloslaw.politowski@olx.pl>
Co-authored-by: Sami Jaber <me@sami.website>
  • Loading branch information
3 people authored Jan 22, 2024
1 parent 9e15287 commit ee99699
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-phones-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@builder.io/react-hydration-overlay": patch
---

Fix: remove filename checks (improves hydration error check)
3 changes: 1 addition & 2 deletions packages/lib/src/hydration-overlay-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ window.BUILDER_HYDRATION_OVERLAY = {};

window.addEventListener("error", (event) => {
const msg = event.message.toLowerCase();
const isReactDomError = event.filename.includes("react-dom");
const isHydrationMsg = msg.includes("hydration") || msg.includes("hydrating");

if (isReactDomError && isHydrationMsg) {
if (isHydrationMsg) {
window.BUILDER_HYDRATION_OVERLAY.ERROR = true;
let appRootEl = document.querySelector(
window.BUILDER_HYDRATION_OVERLAY.APP_ROOT_SELECTOR
Expand Down

0 comments on commit ee99699

Please sign in to comment.