Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(soup): restore search text from the history entry directly on mount (#4356)

gbirman55390ef2d4ba
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx
index b374174e78..fd8bd7ab39 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx
@@ -47,10 +47,17 @@ export const SoupSearchbar = (props: SoupSearchbarProps) => {
const soup = useSoup();
const panel = useSplitPanelOrThrow();
- // Read the current search-text signal once at mount so the editor opens
- // with whatever was captured into per-entry state by the last visit.
- // Falls back to the explicit `initialValue` prop when entry state is empty.
- const initialEditorValue = searchText() || props.initialValue;
+ // Open the editor with the text persisted on this history entry. Read the
+ // entry blob directly rather than the provider's searchText() signal: the soup
+ // provider persists across content swaps, so on re-entry the signal can
+ // lag the per-entry restore, and the editor reads its initial value only once
+ // (it would open empty and never recover). Fall back to the signal, then the
+ // explicit initialValue prop.
+ const persistedSearchText = panel.handle.currentEntryState()?.['search.text'];
+ const initialEditorValue =
+ typeof persistedSearchText === 'string'
+ ? persistedSearchText
+ : searchText() || props.initialValue;
const [hasContent, setHasContent] = createSignal(false);
const [latestMarkdown, setLatestMarkdown] = createSignal('');