mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
- fix(dashboard): /dashboard/system/proxy 500'd on EVERY render — #5918 put useProxyBatchOperations(load) before the const load declaration (TDZ ReferenceError, digest 539380095). Hook block moved after load; SSR renderToString regression test added (the exact crash mode). - fix(server): TRACE/TRACK/CONNECT crashed Next's middleware adapter (undici cannot represent them) into a raw 500 on every route — the raw HTTP method guard now answers 405 + Allow up-front (dast-smoke Schemathesis finding on /api/keys/{id}/devices); guard test added. - fix(api): restore Zod validation on the provider-scoped chat route via a .passthrough() schema preserving #5907's relaxed semantics (t06 gate). - docs(openapi): /api/keys/{id}/devices 401 now refs the management error envelope (Schemathesis schema-conformance). - quality: rebaseline i18nUiCoverage 77.5->76.8 (+~1352 new en.json UI keys from the cycle await the async translation workflow; v3.8.39 precedent). - CodeQL: dismissed 2 incomplete-url-substring FPs on unit-test asserts (v3.8.35 precedent) with Hard Rule #14 justifications. - changelog: bullets for the above + 42 i18n mirrors re-synced
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
// @vitest-environment jsdom
|
|
import React from "react";
|
|
import { renderToString } from "react-dom/server";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
// Regression guard for the #5918 TDZ crash: ProxyRegistryManager called
|
|
// `useProxyBatchOperations(load)` BEFORE the `const load = useCallback(...)`
|
|
// declaration in the component body, so every SERVER render threw
|
|
// `ReferenceError: Cannot access 'load' before initialization` — the whole
|
|
// /dashboard/system/proxy page 500'd in production (digest 539380095), caught
|
|
// only by the release-PR e2e smoke (the PR→release fast-gates render nothing).
|
|
// renderToString mirrors that SSR path exactly (no effects, no fetches) and is
|
|
// synchronous — this test fails-without-the-fix at the first render.
|
|
|
|
vi.mock("next-intl", () => ({
|
|
useTranslations: () => (key: string) => key,
|
|
}));
|
|
|
|
describe("ProxyRegistryManager (TDZ regression #5918)", () => {
|
|
it("server-renders without a use-before-init ReferenceError", async () => {
|
|
const { default: ProxyRegistryManager } =
|
|
await import("@/app/(dashboard)/dashboard/settings/components/ProxyRegistryManager");
|
|
const html = renderToString(React.createElement(ProxyRegistryManager));
|
|
// The heading key is rendered via the mocked translator (key echo).
|
|
expect(html).toContain("title");
|
|
});
|
|
});
|