Skip to content

Commit

Permalink
Save on preview to prevent error on uploaded form file
Browse files Browse the repository at this point in the history
  • Loading branch information
dsamojlenko committed Jan 17, 2025
1 parent 0f166ca commit dbe8246
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
"use client";
import React from "react";
import { LangSwitcher } from "@formBuilder/components/shared/LangSwitcher";
import { SaveButton } from "@formBuilder/components/shared/SaveButton";

export const PreviewNavigation = () => {
return (
<div className="relative">
<div className="absolute left-0 top-0 mt-2">
{/*
SaveButton should mostly be invisible, but is here to handle
autosave when opening a form file to prevent errors on Settings
*/}
<SaveButton />
</div>
<div className="absolute right-0 top-0">
<LangSwitcher descriptionLangKey="previewingIn" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export const SaveButton = () => {
return null;
}

const showSave = pathname?.includes("edit") || pathname?.includes("translate");
const showSave =
pathname?.includes("edit") || pathname?.includes("translate") || pathname?.includes("preview");

if (!showSave) {
return null;
Expand Down

0 comments on commit dbe8246

Please sign in to comment.