Skip to content

Commit 2c46622

Browse files
committed
fix(search-replace): auto-navigate when hydration resolves with no prior active match
1 parent 3475fe4 commit 2c46622

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/search-replace/workflow-search-replace.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,9 @@ export function WorkflowSearchReplace() {
390390
const replaceIndex = afterReplaceIndexRef.current
391391
afterReplaceIndexRef.current = null
392392

393-
if (queryChanged || justOpened) {
394-
// Intentional navigation: panel opened or query changed — go to first match.
393+
if (queryChanged || justOpened || !activeMatchId) {
394+
// Intentional navigation: query changed, panel just opened, or nothing was
395+
// ever selected (e.g. hydration resolved after open with no matches) — go to first match.
395396
handleSelectMatch(hydratedMatches[0].id)
396397
} else if (replaceIndex !== null) {
397398
// Replace button was clicked: advance to the match now at the same position (clamped),

0 commit comments

Comments
 (0)