sokko-g/e2e/fixtures/storage-startup-probe.js
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

24 lines
1.1 KiB
JavaScript

/**
* @file Expose les commandes du vrai stockage et des actions sous StrictMode pour tester leur verrouillage
* initial.
*/
import { createElement, StrictMode, useLayoutEffect } from "react";
import { createRoot } from "react-dom/client";
import { flushSync } from "react-dom";
import { useIndexedToolboxes } from "../../website/src/features/toolboxes/storage/useIndexedToolboxes.js";
import { useToolboxActions } from "../../website/src/features/toolboxes/useToolboxActions.js";
export function mountStorageStartupProbe(element) {
const root = createRoot(element);
const api = { store: null, actions: null, notices: [] };
const notify = (message) => api.notices.push(message);
function Probe() {
const store = useIndexedToolboxes(notify);
const actions = useToolboxActions({ store, notify, setConfirmModal: notify });
useLayoutEffect(() => { api.store = store; api.actions = actions; });
return null;
}
flushSync(() => root.render(createElement(StrictMode, null, createElement(Probe))));
return { ...api, get store() { return api.store; }, get actions() { return api.actions; }, unmount: () => root.unmount() };
}