Skip to content

Commit 9f3f195

Browse files
committed
fix(webapp): reset the seek budget when the agent logo changes seek mode
Switching from the next-shape search to the settle-to-rest search reused the spent step budget, so the fallback could fire immediately and snap the logo back from an arbitrary dot instead of one shared with the rest shape.
1 parent 87b4599 commit 9f3f195

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/webapp/app/routes/storybook.ai-agent/AgentDotMatrix.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,13 @@ export function AgentDotMatrix({
503503
history.unshift(route[headPos]);
504504
if (history.length > SNAKE_TAIL.length) history.length = SNAKE_TAIL.length;
505505

506+
// Every change of seek mode restarts the step budget, so each search gets
507+
// a full lap to find a shared dot before its fallback fires.
506508
if (!activeRef.current) {
507-
seeking = "rest";
509+
if (seeking !== "rest") {
510+
seeking = "rest";
511+
seekSteps = 0;
512+
}
508513
} else {
509514
if (seeking === "rest") {
510515
// Re-activated mid-settle: cancel the pending return to rest so a
@@ -514,6 +519,7 @@ export function AgentDotMatrix({
514519
}
515520
if (seeking !== "next" && stepsInShape >= cyclesPerShape * route.length) {
516521
seeking = "next";
522+
seekSteps = 0;
517523
}
518524
}
519525
if (!seeking) return;

0 commit comments

Comments
 (0)