Skip to content

[Bug] playgroundStore mutates state in place; useSkillPackage shows the previous skill's files under the next skill's header #1054

@chronoai-shining

Description

@chronoai-shining

Summary

Found during fine-grained code-quality review (second pass) at commit 14fbf3e (develop). Severity: medium — bug. Two state-correctness bugs:

  1. playgroundStore.addToolCall mutates state in placestores/playgroundStore.ts:104-120, line 109: lastMsg.toolCalls = [...] mutates the message object still referenced by the previous state array. Memoized components/selectors comparing message identity won't re-render, and devtools history is corrupted. Fix: rebuild immutably (msgs[i] = { ...lastMsg, toolCalls: [...] }).
  2. useSkillPackage serves the previous skill's fileshooks/useSkillPackage.ts:73-76: if (!presignedUrl) return; keeps the prior files/fileContents/rawZip state. Navigating from skill A (with package) to skill B whose presignedPackageUrl is absent (permission-gated payloads) renders A's file tree and contents under B's header — a cross-skill content leak in the UI. Fix: reset the state slots before the early return and on every URL change before fetch resolves.

Related to #1001 (the sibling cross-skill edit-leak on the same page).

Metadata

Metadata

Labels

auto:eligible/auto MAY pick this issue for autonomous work. Required to claim.size:SSmall: < ~1h, single file/concern. Size is informational.type:bugDefect: behavior diverges from intent/spec.webornn-web frontend SPA

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions