Skip to content

layout_switch: visual and data context don't stay in sync #198

Description

@Plyman616

Bug Description

When layout_switch is called to switch between saved layouts, the visual chart and data reading tools do not stay in sync.

Steps to Reproduce

  1. Start on 5MIN layout (has VWAP, SFI, NMI, EMAs, etc.)
  2. Call layout_switch with name NEWDAILY — returns success: true
  3. Call chart_get_state — returns indicators from the 5MIN layout, not NEWDAILY
  4. Call data_get_study_values — returns VWAP, SFI and other indicators that do not exist on NEWDAILY — silently wrong with no error
  5. Switch back via layout_switch to 5MIN — data context switches but visual chart on screen does not update

Expected Behavior

After layout_switch succeeds, both the visual chart and all data tools (chart_get_state, data_get_study_values, data_get_ohlcv) reflect the newly loaded layout.

Actual Behavior

  • layout_switch → NEWDAILY: Visual switched ✓, data context stayed on 5MIN ✗
  • layout_switch → 5MIN: Data context switched ✓, visual stayed on NEWDAILY ✗

The visual layer and data layer are completely decoupled. Indicator values reported after a layout switch may correspond to indicators that don't exist on the target layout — silently incorrect with no error signal.

Additional Notes

  • chart_ready: false was returned by a subsequent chart_set_symbol call, suggesting the layout hadn't fully initialized
  • capture_screenshot also lags after layout/symbol switches — related rendering issue
  • Workaround: have user switch layouts manually; stay on original layout for data reads

Impact

High — silently returns wrong indicator data after a layout switch. Caller has no way to detect that values are from the wrong layout context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions