Skip to content

Fix: forget a closed action's cached schema when it is unmounted - #20361

Open
webard wants to merge 1 commit into
filamentphp:4.xfrom
webard:fix/unmount-action-leaves-a-stale-schema-cache
Open

Fix: forget a closed action's cached schema when it is unmounted#20361
webard wants to merge 1 commit into
filamentphp:4.xfrom
webard:fix/unmount-action-leaves-a-stale-schema-cache

Conversation

@webard

@webard webard commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

unmountAction() pops the action off mountedActions, but leaves its schema in cachedSchemas
under mountedActionSchema{nestingIndex}. getMountedActionSchema() reads that cache before it
builds anything, so an action mounted at the same nesting index later in the same request is handed the schema of
the action that has just closed.

This causes actions to have their own header and footer, but someone else’s form. The bug appeared while testing the modalClickThrough() method. It occurred when I opened one action and then, without closing the current one, opened another.

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.

@webard

webard commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

I realize that the same fix can be achieved in userland with the replaceMountedAction() method, but that is not entirely intuitive, and not handling this automatically introduces a silent bug.

However, if replaceMountedAction() is intended to be the only way to fix this problem, I fully agree with that and will close the PR.

@danharrin danharrin added bug Something isn't working pending review labels Aug 13, 2026
@danharrin danharrin added this to the v4 milestone Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants