fix: lots of missing pieces for python macro handling

This commit is contained in:
2026-02-27 08:33:12 +01:00
parent 916d9459ef
commit 00cf30a8f8
31 changed files with 1715 additions and 431 deletions

View File

@@ -14,6 +14,8 @@ import {
import { createDeferredEventGate } from './navigation/deferredEventGate';
import { createAndFocusPost } from './navigation/postCreation';
import { ensureRendererPicoThemeStylesheet, getRendererPicoTheme } from './utils/picoTheme';
import { addWindowEventListener, BDS_EVENT_SCRIPTS_CHANGED } from './utils/windowEvents';
import { refreshPythonMacroSlugs } from './macros';
import { useI18n } from './i18n';
import './App.css';
@@ -104,6 +106,9 @@ const App: React.FC = () => {
if (tasks) {
setTasks(tasks as TaskProgress[]);
}
// Load known Python macro slugs for editor detection
await refreshPythonMacroSlugs();
} catch (error) {
console.error('Failed to load initial data:', error);
} finally {
@@ -557,6 +562,13 @@ const App: React.FC = () => {
}) || (() => {})
);
// Refresh Python macro slugs when scripts change
unsubscribers.push(
addWindowEventListener(BDS_EVENT_SCRIPTS_CHANGED, () => {
void refreshPythonMacroSlugs();
})
);
void window.electronAPI?.app.notifyRendererReady?.().catch((error) => {
console.error('Failed to notify renderer readiness:', error);
});