fix: delete tab on delete of published post
This commit is contained in:
@@ -126,6 +126,7 @@ const App: React.FC = () => {
|
|||||||
unsubscribers.push(
|
unsubscribers.push(
|
||||||
window.electronAPI?.on('post:deleted', (id: unknown) => {
|
window.electronAPI?.on('post:deleted', (id: unknown) => {
|
||||||
removePost(id as string);
|
removePost(id as string);
|
||||||
|
useAppStore.getState().closeTab(id as string);
|
||||||
}) || (() => {})
|
}) || (() => {})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -994,6 +994,7 @@ const PostEditor: React.FC<PostEditorProps> = ({ postId }) => {
|
|||||||
// Clear pending ref to prevent auto-save on unmount from resurrecting the post
|
// Clear pending ref to prevent auto-save on unmount from resurrecting the post
|
||||||
pendingChangesRef.current = null;
|
pendingChangesRef.current = null;
|
||||||
useAppStore.getState().removePost(postId);
|
useAppStore.getState().removePost(postId);
|
||||||
|
useAppStore.getState().closeTab(postId);
|
||||||
useAppStore.getState().setSelectedPost(null);
|
useAppStore.getState().setSelectedPost(null);
|
||||||
showToast.success('Post deleted');
|
showToast.success('Post deleted');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user