Skip to content
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

Pagination error #546

Open
hilaryb opened this issue Feb 7, 2025 · 5 comments
Open

Pagination error #546

hilaryb opened this issue Feb 7, 2025 · 5 comments

Comments

@hilaryb
Copy link

hilaryb commented Feb 7, 2025

On the Users list, the first click on a pagination button works ok but subsequent clicks produce a silent error in the browser console and navigation to next page does not work. The Filter selection on the users page also produces the same error.

Image

@hilaryb
Copy link
Author

hilaryb commented Feb 9, 2025

If I change the Pager template in bonfire/Views/_table.php from 'bonfire_full_hx' to 'bonfire_full' it works ok.
The User filter also uses .htmx but I am unsure how to fix this.

@dgvirtual
Copy link
Collaborator

dgvirtual commented Feb 9, 2025

@hilaryb, thanks for reporting this, although I knew about this issue.

This is a problem of incompatibility between the CI4 Debug toolbar and HTMX calls. Another manifestation you can see in the use of the filter of user list; the first filter checkbox works, the subsequent - do not.

There are two ways to deal with it.

First, you can swith to production mode. No debug toolbar = no issue.

Second solution - you could install a package by @michalsn to deal with it automatically (no other changes required, unless you are still on php 7):

composer require michalsn/codeigniter-htmx

Perhaps we should add it to dependencies (except that we do not use any other sweet functionality it provides, so maybe to development requirements?).

Changing the pager to bonfire_full will switch the paging back to simple GET requests instead of HTMX/XHR, and in does work on its own, but it interferes with the filter functionality (filter does not keep the state while the filter parameters continue to be applied, and the url gets ugly).

@hilaryb
Copy link
Author

hilaryb commented Feb 9, 2025

@dgvirtual, Thanks for the reply.
I just switched off the debug toolbar in bonfire/Config/Registrar and all is working as it should.

I will install the package you suggested and see if that fixes the problem.

Thank you so much for your help.

@hilaryb
Copy link
Author

hilaryb commented Feb 9, 2025

@dgvirtual Installed the package and now working ok.

Thank you again.

@dgvirtual
Copy link
Collaborator

I will think about how to best deal with this issue before marking it as closed...

The best way seems to be to include @michalsn codeigniter-htmx package into require or require-dev blocks of composer.json. But then we would need to drop the compatibility with PHP 7.4 for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants