feat(editor): save leptos island and page aggregate alignment progress
- switch main document flow toward leptos tiptap island host and generated runtime assets - align page aggregate loading, page head single-source updates, and AI tool result recovery - add tests and smoke scripts for title sync, AI route recovery, and editor host cutover
This commit is contained in:
@@ -32,6 +32,7 @@ export interface EditorReferenceBridge {
|
||||
insertOnlineTableAsset?: (args: { documentId: string; tableId: string }) => void;
|
||||
replaceWithSnapshot: (blocks: Json) => void;
|
||||
openTableFullScreen?: (tableId: string) => void;
|
||||
requestFallbackToBlockNote?: () => void;
|
||||
}
|
||||
|
||||
interface EditorBridgeState {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { useSidebarStore } from "@/store/sidebar";
|
||||
|
||||
describe("useSidebarStore hydration", () => {
|
||||
afterEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
it("模块初始化时应保持默认首帧状态,避免先读持久化状态", () => {
|
||||
const state = useSidebarStore.getState();
|
||||
|
||||
expect(state.open).toBe(false);
|
||||
expect(state.width).toBe(280);
|
||||
expect(state.viewMode).toBe("section");
|
||||
});
|
||||
|
||||
it("手动 hydrate 后才应用持久化状态", () => {
|
||||
localStorage.setItem(
|
||||
"sidebar-ui",
|
||||
JSON.stringify({
|
||||
state: {
|
||||
open: true,
|
||||
width: 360,
|
||||
collapsedSections: {
|
||||
starred: false,
|
||||
public: false,
|
||||
shared: false,
|
||||
private: true,
|
||||
templates: false,
|
||||
},
|
||||
trashConfirm: false,
|
||||
viewMode: "filesystem",
|
||||
},
|
||||
version: 4,
|
||||
}),
|
||||
);
|
||||
|
||||
const store = useSidebarStore;
|
||||
expect(store.persist.hasHydrated()).toBe(false);
|
||||
void store.persist.rehydrate();
|
||||
|
||||
expect(store.getState().open).toBe(true);
|
||||
expect(store.getState().width).toBe(360);
|
||||
expect(store.getState().viewMode).toBe("filesystem");
|
||||
expect(store.persist.hasHydrated()).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -56,6 +56,7 @@ export const useSidebarStore = create<SidebarState>()(
|
||||
{
|
||||
name: "sidebar-ui",
|
||||
version: 4,
|
||||
skipHydration: true,
|
||||
migrate: (persistedState, version) => {
|
||||
const state = persistedState as
|
||||
| Partial<
|
||||
|
||||
Reference in New Issue
Block a user