修复画布返回首页跳转后不自动加载问题
This commit is contained in:
parent
31bc50fc64
commit
05653f12f6
@ -89,6 +89,11 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
const routeParams = useParams();
|
||||
const id = (routeParams?.id as string) || use(params).id;
|
||||
const router = useRouter();
|
||||
const goHome = useCallback(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
window.location.assign("/");
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Store state
|
||||
const projectTitle = useCanvasStore((state) => state.projectTitle);
|
||||
@ -485,7 +490,7 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => router.push("/")}
|
||||
onClick={goHome}
|
||||
className="h-14 w-14 rounded-2xl border bg-background/85 p-0 shadow-sm backdrop-blur-md hover:bg-background"
|
||||
>
|
||||
{(siteSettingsData?.siteLogo || siteSettingsData?.siteLogoDark) ? (
|
||||
@ -508,7 +513,7 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
||||
<div className="absolute top-4 left-[5.5rem] z-20 flex items-center gap-2 bg-background/80 backdrop-blur-md border rounded-xl p-1.5 shadow-sm">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="ghost" size="icon" onClick={() => router.push('/')} className="rounded-lg h-8 w-8">
|
||||
<Button variant="ghost" size="icon" onClick={goHome} className="rounded-lg h-8 w-8">
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user