mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
Three unrelated defects, one image. The profile toast fired only after a session refresh. That refresh is a second read: it can stall, and when it answers unauthenticated it clears the session, which throws in useSession and takes down the subtree holding the toaster. A save that had already persisted could therefore go unconfirmed. The save is confirmed on the save now and the refresh follows it, so the confirmation depends only on the thing it reports. Document bytes are routed by NEXT_PUBLIC_UPLOAD_TRANSPORT. Three places read it with three slightly different rules, and the two that chose a store fell through to the database for any value they did not recognise -- so a transport named under a variable nothing reads stored every PDF inline while the configuration read as object storage, with nothing logged either way. One function resolves it now: unset means the database, and an unrecognised value throws rather than quietly picking a store. Reads still dispatch on each row's own type, so rows written under either transport keep working. entry.client and entry.server built different root trees -- StrictMode on the client only, and a second child beside the router. useId numbers a component by its position, and a parent's child count is part of that position, so every id below the root diverged and hydration failed on the first component to ask for one. Measured on the documents page: the header's menu trigger came back radix-:R26j5: from the server and radix-:R8qcl: from the client. The trees are identical now and all seven server-rendered ids survive hydration unchanged. Also: .gitignore still named the license artifact by its pre-rebrand filename, so the file the app actually writes was landing in git status untracked.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { StrictMode, startTransition } from 'react';
|
|
|
|
import insights from '@hanzo/insights';
|
|
import { i18n } from '@lingui/core';
|
|
import { detect, fromHtmlTag } from '@lingui/detect-locale';
|
|
import { I18nProvider } from '@lingui/react';
|
|
import { hydrateRoot } from 'react-dom/client';
|
|
import { HydratedRouter } from 'react-router/dom';
|
|
|
|
import { extractInsightsConfig } from '@hanzo/esign-lib/constants/feature-flags';
|
|
import { dynamicActivate } from '@hanzo/esign-lib/utils/i18n';
|
|
|
|
import './utils/polyfills/promise-with-resolvers';
|
|
|
|
async function main() {
|
|
const locale = detect(fromHtmlTag('lang')) || 'en';
|
|
|
|
await dynamicActivate(locale);
|
|
|
|
const insightsConfig = extractInsightsConfig();
|
|
|
|
if (insightsConfig) {
|
|
insights.init(insightsConfig.key, {
|
|
api_host: insightsConfig.host,
|
|
capture_exceptions: true,
|
|
});
|
|
}
|
|
|
|
// This tree has to match entry.server's exactly. `useId` numbers a component
|
|
// by its position, and the count of its parent's children is part of that
|
|
// position — so a wrapper on one side only, or a second child beside the
|
|
// router, renumbers every id underneath and hydration fails on the first
|
|
// component that asks for one. Starting insights here rather than as a second
|
|
// child is what keeps the shapes equal.
|
|
startTransition(() => {
|
|
hydrateRoot(
|
|
document,
|
|
<StrictMode>
|
|
<I18nProvider i18n={i18n}>
|
|
<HydratedRouter />
|
|
</I18nProvider>
|
|
</StrictMode>,
|
|
);
|
|
});
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
main();
|