Skip to content

Commit

Permalink
disable semgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Mar 26, 2024
1 parent 36fd983 commit bf15207
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/client-react-streaming/src/util/hydrationTest.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { hydrateRoot } from "react-dom/client";

/* eslint-disable */
// prettier-ignore
/** React completeSegment function */
// @ts-expect-error This is React code.
export function $RS(a, b) { a = document.getElementById(a); b = document.getElementById(b); for (a.parentNode.removeChild(a); a.firstChild;)b.parentNode.insertBefore(a.firstChild, b); b.parentNode.removeChild(b) }
// prettier-ignore
/** React completeBoundary function */
// @ts-expect-error This is React code.
// eslint-disable-next-line no-var
export function $RC(b, c, e = undefined) { c = document.getElementById(c); c.parentNode.removeChild(c); var a = document.getElementById(b); if (a) { b = a.previousSibling; if (e) b.data = "$!", a.setAttribute("data-dgst", e); else { e = b.parentNode; a = b.nextSibling; var f = 0; do { if (a && 8 === a.nodeType) { var d = a.data; if ("/$" === d) if (0 === f) break; else f--; else "$" !== d && "$?" !== d && "$!" !== d || f++ } d = a.nextSibling; e.removeChild(a); a = d } while (a); for (; c.firstChild;)e.insertBefore(c.firstChild, a); b.data = "$" } b._reactRetry && b._reactRetry() } }
/* eslint-enable */

export function hydrateBody(
initialChildren: Parameters<typeof hydrateRoot>[1],
Expand All @@ -20,11 +21,13 @@ export function hydrateBody(
export function setBody(html: TemplateStringsArray) {
if (html.length !== 1)
throw new Error("Expected exactly one template string");
// nosemgrep
document.body.innerHTML = html[0];
}

export function appendToBody(html: TemplateStringsArray) {
if (html.length !== 1)
throw new Error("Expected exactly one template string");
// nosemgrep
document.body.insertAdjacentHTML("beforeend", html[0]);
}

0 comments on commit bf15207

Please sign in to comment.