refactor: migrate img tags to next/image and fix hook usage
This commit is contained in:
@@ -17,11 +17,11 @@ import {
|
||||
} from "react";
|
||||
import { useMachine } from "@xstate/react";
|
||||
|
||||
import { sidebarMachine } from "./machine/sidebar-machine";
|
||||
import { sidebarMachine } from "./sidebar-machine";
|
||||
import type {
|
||||
SidebarState as MachineContext,
|
||||
SidebarEvent,
|
||||
} from "./machine/sidebar-machine";
|
||||
} from "./sidebar-machine";
|
||||
|
||||
/**
|
||||
* 对外暴露的 State 形状(保持与原 SidebarState 兼容)
|
||||
@@ -37,7 +37,7 @@ const SidebarStateCtx = createContext<SidebarState | null>(null);
|
||||
const SidebarDispatchCtx = createContext<Dispatch<SidebarEvent> | null>(null);
|
||||
|
||||
export function SidebarProvider({ children }: { children: ReactNode }) {
|
||||
const [state, send] = useMachine(sidebarMachine);
|
||||
const [state, send] = useMachine(sidebarMachine, {});
|
||||
|
||||
// 映射 XState 状态机快照 → 原 SidebarState 形状
|
||||
const sidebarState = useMemo<SidebarState>(
|
||||
|
||||
Reference in New Issue
Block a user