Skip to content

Workflow Editor Header: Switch to latest version button #3628

@theroinaochieng

Description

@theroinaochieng

User story

As a user viewing a historical snapshot, I can quickly return to the latest version to resume editing.

Details

Display button to switch from snapshot view back to latest version. Currently implemented at edit.ex:154-164.

Current behavior:

  • Only visible when viewing snapshot (snapshot_version_tag != "latest")
  • Primary theme button with text "Switch to latest version"
  • Triggers switch-version event with type: "commit"
  • Positioned with right margin (mr-4) before action controls

Implementation notes

  • Event handler at handle_event("switch-version", %{"type" => "commit"}, socket) line 1709
  • Calls commit_latest_version/1 function (line 2726) which:
    • Loads workflow's latest snapshot by lock_version
    • Updates workflow, snapshot, and params assigns
    • Removes query params: method, w-chat, j-chat
    • Redirects to latest version URL
  • Button ID follows pattern: version-switcher-button-#{workflow.id}
  • Depends on Workflow Editor Header: Core layout and breadcrumb container #3624

Release notes

N/A - Internal refactor maintaining existing functionality

User acceptance criteria

  • Button appears only when viewing snapshots
  • Button hidden when viewing latest version
  • Clicking button loads latest workflow version
  • URL updates to remove version parameter
  • Selected entities remain selected if still present in latest version

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    New Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions