Skip to content

Instantly share code, notes, and snippets.

@thomasballinger
Last active November 4, 2024 20:17
Show Gist options
  • Save thomasballinger/883c45f2dbb65ccebc2722c97bb18f88 to your computer and use it in GitHub Desktop.
Save thomasballinger/883c45f2dbb65ccebc2722c97bb18f88 to your computer and use it in GitHub Desktop.
pre/post SSR diff
9,43d8
< <script class="tsr-once">
< __TSR__ = {
< matches: [],
< streamedValues: {},
< initMatch: (index) => {
< Object.entries(__TSR__.matches[index].extracted).forEach(([id, ex]) => {
< if (ex.type === "stream") {
< let controller;
< ex.value = new ReadableStream({
< start(c) {
< controller = c;
< },
< });
< ex.value.controller = controller;
< } else if (ex.type === "promise") {
< let r, j;
< ex.value = new Promise((r_, j_) => {
< (r = r_), (j = j_);
< });
< ex.resolve = r;
< ex.reject = j;
< }
< });
< },
< cleanScripts: () => {
< document.querySelectorAll(".tsr-once").forEach((el) => {
< el.remove();
< });
< },
< };
< </script>
< <script class="tsr-once">
< __TSR__.dehydrated =
< '{"router":{"state":{"dehydratedMatches":[{"id":"__root__","status":"success","updatedAt":1730751251860,"error":{"$undefined":""}},{"id":"/","status":"success","updatedAt":1730751251860,"error":{"$undefined":""}}]},"manifest":{"routes":{"__root__":{"preloads":["/_build/assets/client-Co7p-Pn6.js","/_build/assets/client-CdPkfDul.js"],"assets":[{"tag":"script","attrs":{"src":"/_build/assets/client-Co7p-Pn6.js","type":"module","async":true,"suppressHydrationWarning":true}}]},"/":{"preloads":{"$undefined":""},"assets":{"$undefined":""}}}}},"payload":{"dehydratedQueryClient":{"mutations":[],"queries":[]}}}';
< </script>
59,66d23
< <script class="tsr-once">
< __TSR__.matches[1] = {
< __beforeLoadContext: "{}",
< loaderData: '{"$undefined":""}',
< extracted: {},
< };
< __TSR__.initMatch(1);
< </script>
76,83d32
< <script class="tsr-once">
< __TSR__.matches[0] = {
< __beforeLoadContext: "{}",
< loaderData: '{"$undefined":""}',
< extracted: {},
< };
< __TSR__.initMatch(0);
< </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment