PostMessageManager uses different payload shapes for incoming and outgoing postMessage communication.
Incoming messages are handled as:
{ event, detail }
But outgoing messages are sent as:
{ eventName, eventDetail }
This creates an inconsistent contract between Open Cells and the parent window.
Affected code
packages/core/src/manager/post-message.js
incoming message handling reads data.event and data.detail
outgoing message sending uses eventName and eventDetail
Why this is a problem
This code is responsible for communication between the app and window.parent via postMessage.
Because the payload format is not consistent in both directions, integrations may fail or behave unexpectedly. In particular:
parent applications may not recognize messages emitted by Open Cells
Open Cells may ignore messages coming from a host application that uses a different shape
the *-ready signal may not be detected correctly
iframe/app-shell integrations can break silently
Current behavior
Incoming messages are read from:
data.event
data.detail
Outgoing messages are sent as:
{
eventName: evt.event,
eventDetail: evt.detail
}
Expected behavior
The same payload shape should be used consistently in both directions.
For example:
{
event: 'my-event',
detail: payload
}
Suggested fix standardize outgoing messages to use { event, detail }
optionally keep backward compatibility for incoming legacy messages using { eventName, eventDetail }
add tests covering both incoming and outgoing payload formats
PostMessageManager uses different payload shapes for incoming and outgoing postMessage communication.
Incoming messages are handled as:
{ event, detail }
But outgoing messages are sent as:
{ eventName, eventDetail }
This creates an inconsistent contract between Open Cells and the parent window.
Affected code
packages/core/src/manager/post-message.js
incoming message handling reads data.event and data.detail
outgoing message sending uses eventName and eventDetail
Why this is a problem
This code is responsible for communication between the app and window.parent via postMessage.
Because the payload format is not consistent in both directions, integrations may fail or behave unexpectedly. In particular:
parent applications may not recognize messages emitted by Open Cells
Open Cells may ignore messages coming from a host application that uses a different shape
the *-ready signal may not be detected correctly
iframe/app-shell integrations can break silently
Current behavior
Incoming messages are read from:
data.event
data.detail
Outgoing messages are sent as:
{
eventName: evt.event,
eventDetail: evt.detail
}
Expected behavior
The same payload shape should be used consistently in both directions.
For example:
{
event: 'my-event',
detail: payload
}
Suggested fix standardize outgoing messages to use { event, detail }
optionally keep backward compatibility for incoming legacy messages using { eventName, eventDetail }
add tests covering both incoming and outgoing payload formats