fix: transform handlers don't auto-open bottom panel unnecessarily
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
buildBlogmarkTransformOutputEntries,
|
||||
buildBlogmarkTransformToastNotifications,
|
||||
parseBlogmarkCreatedEventPayload,
|
||||
shouldAutoOpenPanelForOutputEntries,
|
||||
} from './navigation/blogmarkTransformOutput';
|
||||
import { createDeferredEventGate } from './navigation/deferredEventGate';
|
||||
import { createAndFocusPost } from './navigation/postCreation';
|
||||
@@ -288,10 +289,12 @@ const App: React.FC = () => {
|
||||
});
|
||||
});
|
||||
|
||||
useAppStore.setState({
|
||||
panelVisible: true,
|
||||
panelActiveTab: 'output',
|
||||
});
|
||||
if (shouldAutoOpenPanelForOutputEntries(outputEntries)) {
|
||||
useAppStore.setState({
|
||||
panelVisible: true,
|
||||
panelActiveTab: 'output',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
blogmarkEventGateRef.current.push(created, processBlogmarkCreated);
|
||||
|
||||
@@ -142,6 +142,12 @@ export function buildBlogmarkTransformOutputEntries(
|
||||
return entries;
|
||||
}
|
||||
|
||||
export function shouldAutoOpenPanelForOutputEntries(
|
||||
entries: Array<Omit<PanelOutputEntry, 'id' | 'createdAt'>>,
|
||||
): boolean {
|
||||
return entries.some((entry) => entry.kind === 'error' || entry.kind === 'stdout');
|
||||
}
|
||||
|
||||
export function buildBlogmarkTransformToastNotifications(
|
||||
transform: BlogmarkTransformDebugInfo | undefined,
|
||||
t: (key: string, values?: Record<string, string | number>) => string,
|
||||
|
||||
Reference in New Issue
Block a user