-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6479bb6
commit 9018a16
Showing
15 changed files
with
211 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export { RemixDevTools } from "./RemixDevTools"; | ||
export { useRemixForgeSocketExternal as useRemixForgeSocket } from "./hooks/useRemixForgeSocket"; | ||
export { | ||
initRouteBoundariesClient, | ||
initRouteBoundariesServer, | ||
} from "./methods/boundaries"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { EntryContext } from "@remix-run/server-runtime"; | ||
import clsx from "clsx"; | ||
|
||
export const initRouteBoundariesServer = (context: EntryContext) => { | ||
return { | ||
...context, | ||
routeModules: Object.entries(context.routeModules).reduce( | ||
(acc, [key, value]) => { | ||
if (key === "root") { | ||
return { ...acc, [key]: value }; | ||
} | ||
return { | ||
...acc, | ||
[key]: { | ||
...value, | ||
default: () => { | ||
return ( | ||
<> | ||
<div | ||
className={clsx( | ||
"rdt-invisible rdt-absolute rdt-hidden rdt-h-0 rdt-w-0", | ||
key | ||
)} | ||
/> | ||
<value.default /> | ||
</> | ||
); | ||
}, | ||
}, | ||
}; | ||
}, | ||
{} | ||
), | ||
}; | ||
}; | ||
|
||
export const initRouteBoundariesClient = () => { | ||
window.__remixRouteModules = new Proxy(window.__remixRouteModules, { | ||
get: function (target, property) { | ||
if (property === "root") return target[property]; | ||
const value = target[property as any]; | ||
if (value?.default && value.default.name !== "hooked") { | ||
return { | ||
...value, | ||
default: function hooked() { | ||
return ( | ||
<> | ||
<div | ||
className={clsx( | ||
"rdt-invisible rdt-absolute rdt-hidden rdt-h-0 rdt-w-0", | ||
property as string | ||
)} | ||
/> | ||
<value.default /> | ||
</> | ||
); | ||
}, | ||
}; | ||
} | ||
|
||
return value; | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.