Skip to content

Fix schema component load listener for deferred dispatches#19861

Open
masskrdjn wants to merge 1 commit into
filamentphp:4.xfrom
masskrdjn:fix-richeditor-link-error-while-in-flex-component
Open

Fix schema component load listener for deferred dispatches#19861
masskrdjn wants to merge 1 commit into
filamentphp:4.xfrom
masskrdjn:fix-richeditor-link-error-while-in-flex-component

Conversation

@masskrdjn
Copy link
Copy Markdown

Description

Fixes a JavaScript error triggered when a deferred schema component dispatch waits for a schema component to load.

In some cases, such as using a RichEditor inside a Flex component, the Livewire commit hook payload does not expose the component through the component variable used by the listener. This caused:

ReferenceError: component is not defined

The schema dispatch listener now resolves the Livewire component from either the hook payload or the message payload before querying schema partials and registering the schema-component-*-loaded event listener.

Visual changes

No visual changes.

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

composer cs could not be run locally because the available CLI PHP version is 8.2.30, while the locked dependencies require PHP 8.3+ / 8.4 and the zip and sockets extensions.

Resolve the Livewire component from either the commit hook payload or the
message payload before querying schema partials and registering the delayed loaded event listener. This prevents a ReferenceError when rich editor actions inside deferred schema components, such as Flex, wait for the component to load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant