Skip to content

Instance view: history-mode toggle does not refetch instance details (stale data source) #94

Description

@javahippie

Summary

Toggling history mode inside a process instance view does not switch the data source of the instance details — the view keeps showing whatever was loaded first (live or history) until a full page reload.

Steps to reproduce

  1. Open a process instance (live view, no ?history=true).
  2. Click "Enable History Mode".

Observed

The URL changes, but state.api.process.instance.one is never refetched — the details still come from GET /process-instance/{id}. The reverse direction (starting in history mode, toggling off) is equally stale.

Root cause (src/pages/Processes.jsx, InstanceDetails)

The fetch is guarded on an empty signal instead of reacting to its inputs:

if (state.api.process.instance.one === undefined ||
    state.api.process.instance.one.value === null) {
  if (!history_mode) { /* live fetch */ } else { /* history fetch */ }
}

Once the signal holds data, toggling history_mode never triggers the other endpoint. InstanceVariables directly below already implements the correct pattern.

Suggested fix

Prototyped locally — same effect pattern as InstanceVariables:

useEffect(() => {
  if (!selection_id) return;
  if (!history_mode) {
    void engine_rest.process_instance.one(state, selection_id);
  } else {
    void engine_rest.history.process_instance.one(state, selection_id);
  }
  // eslint-disable-next-line react-hooks/exhaustive-deps
}, [selection_id, history_mode]);

Note: the GET helper keeps previous data while LOADING, so the toggle does not flicker.

Related

Even with the refetch fixed, the details description currently renders only instance id and business key, so the richer history payload (endTime, durationInMillis, state) remains invisible — tracked separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions