fix(bootstrap): show a static boot shell until the first render (Q-6.9-8)
Boot awaits runtime config (5s budget), the release manifest (5s) and contract-set checks before its first render, and #root was empty the whole time with no busy state. index.html now ships a static loading status (role="status", aria-busy="true", the existing state-surface loading class) inside #root; createRoot's first render — the app or the BootErrorShell — replaces it. Verified: tests/component/bootstrap-shell.test.tsx reads index.html (RED before: no busy status) and checks the first React render removes the shell; `pnpm build` keeps the shell in dist/index.html with the render-blocking CSS link. All gates pass; test:reference-feature's production-vertical test timed out once on "로그인 시작" and passed on rerun (timing flake, unrelated file). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
911561985b
commit
e119eb667a
+12
-1
@@ -7,7 +7,18 @@
|
||||
<title>Clean Architecture Frontend</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<div id="root">
|
||||
<!-- Q-6.9-8. Static boot shell: visible while config, manifest and
|
||||
contract checks run; the first React render replaces it. -->
|
||||
<div
|
||||
class="state-surface state-surface--loading"
|
||||
role="status"
|
||||
aria-busy="true"
|
||||
data-boot-shell=""
|
||||
>
|
||||
불러오는 중
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="/src/bootstrap/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
import { act, render, screen } from "@testing-library/react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
function TestShell() {
|
||||
@@ -15,3 +18,35 @@ describe("component test level", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("static boot shell (Q-6.9-8)", () => {
|
||||
function loadIndexBody(): HTMLElement {
|
||||
const html = readFileSync("index.html", "utf8");
|
||||
document.body.innerHTML = new DOMParser()
|
||||
.parseFromString(html, "text/html")
|
||||
.body.innerHTML;
|
||||
const root = document.getElementById("root");
|
||||
if (!root) throw new Error("index.html has no #root");
|
||||
return root;
|
||||
}
|
||||
|
||||
it("shows a busy loading status before boot renders anything", () => {
|
||||
const root = loadIndexBody();
|
||||
const status = root.querySelector('[role="status"]');
|
||||
expect(status?.getAttribute("aria-busy")).toBe("true");
|
||||
expect(status?.textContent?.trim()).not.toBe("");
|
||||
});
|
||||
|
||||
it("is replaced by the first render of the real app", async () => {
|
||||
const root = loadIndexBody();
|
||||
const reactRoot = createRoot(root);
|
||||
await act(async () => {
|
||||
reactRoot.render(<TestShell />);
|
||||
});
|
||||
expect(root.querySelector('[aria-busy="true"]')).toBeNull();
|
||||
expect(screen.getByRole("main", { name: "application shell" })).toBeTruthy();
|
||||
await act(async () => {
|
||||
reactRoot.unmount();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user