Skip to content

[GUI] selectedArtifact fallback causes unexpected selection jump #67

@Vantalens

Description

@Vantalens

File: packages/gui/src/App.tsx:68

Severity: Medium

Description:
selectedArtifact fallback to artifacts[0] when selectedArtifactId not found causes selection to jump unexpectedly when artifact list updates.

Code:

const selectedArtifact = artifacts.find((artifact) => artifact.id === selectedArtifactId) || artifacts[0];

Failure Scenario:

  • User selects artifact with id='artifact-5'
  • Backend updates artifacts array (new artifact added at beginning or order changed)
  • selectedArtifactId becomes stale (old artifact removed)
  • useMemo returns artifacts[0] instead of null/undefined
  • UI jumps to different artifact without user action
  • User sees wrong artifact preview, confusion ensues

Suggested Fix:
Return null/undefined when selectedArtifactId not found, show empty state or keep last valid selection until user explicitly chooses new one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingguiGUI/frontend related issuesjavascriptPull requests that update javascript codemedium-priorityMedium priority issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions