Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix toggles not working in publish view

Abdullah Atta49d51da1bdd6
diff --git a/apps/web/src/components/publish-view/index.tsx b/apps/web/src/components/publish-view/index.tsx
index e6867127b..f233aca35 100644
--- a/apps/web/src/components/publish-view/index.tsx
+++ b/apps/web/src/components/publish-view/index.tsx
@@ -75,7 +75,7 @@ function PublishView(props: PublishViewProps) {
}
}
})();
- }, [publishId, isPublishing]);
+ }, [publishId, isPublishing, note.id]);
useEffect(() => {
const fileDownloadedEvent = EV.subscribe(
@@ -237,6 +237,7 @@ function PublishView(props: PublishViewProps) {
password
});
setPublishId(publishId);
+ onClose(true);
showToast("success", strings.actions.published.note(1));
} catch (e) {
console.error(e);
diff --git a/apps/web/src/components/toggle/index.jsx b/apps/web/src/components/toggle/index.jsx
index df65616ac..d46134ae9 100644
--- a/apps/web/src/components/toggle/index.jsx
+++ b/apps/web/src/components/toggle/index.jsx
@@ -36,15 +36,13 @@ function Toggle(props) {
} = props;
const [isLoading, setIsLoading] = useState(false);
const onClick = useCallback(async () => {
- if (isToggled) {
- setIsLoading(true);
- try {
- await onToggled();
- } finally {
- setIsLoading(false);
- }
+ setIsLoading(true);
+ try {
+ await onToggled();
+ } finally {
+ setIsLoading(false);
}
- }, [onToggled, isToggled]);
+ }, [onToggled]);
if (onlyIf === false) return null;
return (