-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pagination when there are nested components that don't have pagination #6708
Conversation
Same issue here. |
@Simoneu01 thanks for the PR! In future, please don't use your main branch, create a separate branch with your fix 🙂 I've fixed the issue, but I believe there could be a better implementation. Basically what was happening was the So to fix this, in any of the component hook lifecycle methods ( @calebporzio I think this could be made smoother with a static method that determines whether the hook should even be initialised or not, that gets called in livewire/src/ComponentHookRegistry.php Lines 79 to 88 in ab75c26
If you'd prefer this, let me know and I'll update this PR before it's merged. Otherwise, this PR is good to go as it is. Hope this helps! |
Thank you @joshhanley, will do. |
Thanks for the fix @joshhanley - yeah it makes total sense to add a dedicated API to only use a hook on a component when a condition is met. I don't know exactly what that API is, though... If you have an intuitive idea, feel free to implement it on this PR and we can merge it or tweak it till we're happy. If you'd rather, you can merge this and do that in a separate PR. Up to you. Thanks! |
@calebporzio thanks! I will just merge this for now, and submit a new PR with the proposed changes. |
Have created a new PR #6774 for the conditional hook. |
When there is a nested component before the
->links()
pagination it will result in an errorProperty [$paginators] not found on component: [child]
Example code:
When the nested component is after the pagination it will give no error:
A workaround to fix this issue is to add
use WithPagination;
also on child component, but then it will result an error with the pagination itselfP.S: I have this error in a component that was working with v2