Skip to content

Commit bd00ea4

Browse files
committed
6871: Fixed saveWithoutClose replaced with a useRef
1 parent 15fa4b4 commit bd00ea4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

assets/admin/components/screen/screen-manager.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from "react";
1+
import { useEffect, useRef, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import { useNavigate } from "react-router-dom";
44
import {
@@ -34,7 +34,7 @@ function ScreenManager({
3434
initialState = null,
3535
}) {
3636
const { t } = useTranslation("common", { keyPrefix: "screen-manager" });
37-
const [saveWithoutClose, setSaveWithoutClose] = useState(false);
37+
const saveWithoutCloseRef = useRef(false);
3838
const navigate = useNavigate();
3939
const orientationOptions = [
4040
{ title: "Vertikal", "@id": "vertical" },
@@ -258,7 +258,7 @@ function ScreenManager({
258258
};
259259

260260
const handleSubmitWithRedirect = () => {
261-
setSaveWithoutClose(true);
261+
saveWithoutCloseRef.current = true;
262262
handleSubmit();
263263
};
264264

@@ -268,8 +268,8 @@ function ScreenManager({
268268
displaySuccess(t("success-messages.saved-screen"));
269269
setSavingScreen(false);
270270

271-
if (saveWithoutClose) {
272-
setSaveWithoutClose(false);
271+
if (saveWithoutCloseRef.current) {
272+
saveWithoutCloseRef.current = false;
273273

274274
if (isSaveSuccessPost) {
275275
navigate(`/screen/edit/${idFromUrl(postData["@id"])}`);

0 commit comments

Comments
 (0)