Skip to content

Commit

Permalink
v2.1.4 - Bug fix for route boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak committed Aug 23, 2023
1 parent dc67f9c commit 8693fa5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "remix-development-tools",
"description": "Remix development tools.",
"author": "Alem Tuzlak",
"version": "2.1.3",
"version": "2.1.4",
"license": "MIT",
"keywords": [
"remix",
Expand Down
16 changes: 11 additions & 5 deletions src/RemixDevTools/hooks/useOutletAugment.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
import { useEffect } from "react";
import { InvisibleBoundary } from "../init/project";

const isHooked = Symbol("isHooked");
const isHooked = Symbol("isHooked") as any;

export function useOutletAugment() {
useEffect(() => {
if (window.__remixRouteModules[isHooked as any]) return;
if (window.__remixRouteModules[isHooked]) return;

window.__remixRouteModules = new Proxy(window.__remixRouteModules, {
get: function (target, property) {
if (property === isHooked) return target[property as any];
const key = property as any;
if (property === isHooked) return target[key];
if (property === "root") return target[property];
const value = target[property as any];
const value = target[key];

if (value?.default && value.default.name !== "hooked") {
return {
...value,
default: function hooked() {
// Does not pollute the DOM with invisible boundaries after the first render
if (document.getElementsByClassName(key).length) {
return <value.default />;
}
return (
<>
<InvisibleBoundary path={property as any} />
<InvisibleBoundary path={key} />
<value.default />
</>
);
Expand Down

0 comments on commit 8693fa5

Please sign in to comment.