chore: fix custom widget 's updateModel (#38129)

/ok-to-test tags="@tag.Anvil"

Fixes a bug where appsmith.updateModel was not working properly.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Updated the handling of model updates in the Custom Widget, improving
the way messages are processed from the iframe.

- **Documentation**
- Clarified the expected input for the `onUpdateModel` function in
relation to the message object.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12294856140>
> Commit: cb0ae84342e991d2027a49f3032e815688bcc787
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12294856140&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Thu, 12 Dec 2024 11:12:50 UTC
<!-- end of auto-generated comment: Cypress test results  -->
This commit is contained in:
Pawan Kumar 2024-12-12 17:09:53 +05:30 committed by GitHub
parent 2754698d0f
commit 749f11b835
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,7 +80,7 @@ export function CustomWidgetComponent(props: CustomWidgetComponentProps) {
// the iframe can make changes to the model, when it needs to
// this is done by sending a CUSTOM_WIDGET_UPDATE_MODEL message to the parent window
const handleModelUpdate = (message: Record<string, unknown>) => {
onUpdateModel(message.model as Record<string, unknown>);
onUpdateModel(message as Record<string, unknown>);
};
// the iframe elements can trigger events. Triggered events here would mean