Render hooks are duplicated in grouped relation managers

When Grouped relation managers are used, renderhooks are duplicated in each subsequent relation manager as you can see in the screenshot. This only happens in grouped relation managers and only happens on first render. When clicking any button (be it in the renderhook view or in the table), the duplicated render hooks go away. If you have three relation managers the renderhooks will appear three times, etc.

The issue seems to be in registerRenderHook in FilamentManager. Since grouped relation managers run a loop to output the tables, it duplicates the renderHooks views in the array. Just for ease of access, here is that method:

public function registerRenderHook(string $name, Closure $callback): void
{
    $this->renderHooks[$name][] = $callback;

    ray($callback);

    ray($this->renderHooks);
}


I've attached a screenshot of the ray dump showing the callback and the renderhooks where you can see the AddressRelationManager view being added again to the array.

This isn't related to the content of the view. If you remove all the view content to just be a simple <div>Hello world</div> you still get the duplication.

Not entirely sure how to fix this. If anyone has any suggestions, I can submit a PR.
Screenshot_2023-06-24_at_12.03.04_PM.png
Screenshot_2023-06-24_at_12.08.10_PM.png
Was this page helpful?