Skip to content

Layout messages are forwarded with the wrong payload key in ApiProvider #1145

@SxxAq

Description

@SxxAq

I verified a runtime mismatch in the frontend layout message flow.

In js/api/ApiProvider.js, layout messages are forwarded as:

apiHandlers.current.onLayoutMessage({
  cmd: cmd.data,
  update: cmd.commmand == 'layout_update',
});

But in js/main.js, the handler expects:

const onLayoutMessage = ({ data, update }) => {
  if (update) parseLayoutsFromServer(data);
  else relayout();
};

So ApiProvider sends a cmd field, while onLayoutMessage expects data.

Verified runtime behavior

With temporary console logging added, I observed:

layout message from socket {command: 'layout_update', data: ''}
onLayoutMessage payload {data: undefined, update: false}

and also:

layout message from socket {command: 'layout'}
onLayoutMessage payload {data: undefined, update: false}

This confirms that the payload reaching onLayoutMessage does not match what the handler expects.

Image

Expected behavior

The layout payload should be forwarded under the key that onLayoutMessage destructures, so parseLayoutsFromServer(...) receives the actual layout data.

Possible fix

Either:

  • send { data: cmd.data, update: ... } from ApiProvider, or
  • change onLayoutMessage to destructure { cmd, update }

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