Skip to content

Commit 8693fa5

Browse files
committed
v2.1.4 - Bug fix for route boundaries
1 parent dc67f9c commit 8693fa5

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "remix-development-tools",
33
"description": "Remix development tools.",
44
"author": "Alem Tuzlak",
5-
"version": "2.1.3",
5+
"version": "2.1.4",
66
"license": "MIT",
77
"keywords": [
88
"remix",

src/RemixDevTools/hooks/useOutletAugment.tsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
import { useEffect } from "react";
22
import { InvisibleBoundary } from "../init/project";
33

4-
const isHooked = Symbol("isHooked");
4+
const isHooked = Symbol("isHooked") as any;
5+
56
export function useOutletAugment() {
67
useEffect(() => {
7-
if (window.__remixRouteModules[isHooked as any]) return;
8+
if (window.__remixRouteModules[isHooked]) return;
89

910
window.__remixRouteModules = new Proxy(window.__remixRouteModules, {
1011
get: function (target, property) {
11-
if (property === isHooked) return target[property as any];
12+
const key = property as any;
13+
if (property === isHooked) return target[key];
1214
if (property === "root") return target[property];
13-
const value = target[property as any];
15+
const value = target[key];
1416

1517
if (value?.default && value.default.name !== "hooked") {
1618
return {
1719
...value,
1820
default: function hooked() {
21+
// Does not pollute the DOM with invisible boundaries after the first render
22+
if (document.getElementsByClassName(key).length) {
23+
return <value.default />;
24+
}
1925
return (
2026
<>
21-
<InvisibleBoundary path={property as any} />
27+
<InvisibleBoundary path={key} />
2228
<value.default />
2329
</>
2430
);

0 commit comments

Comments
 (0)