I’m working with the AutoCrud component in Hilla and have run into a couple of issues/questions that I haven’t been able to find documentation or forum discussions about.
Issue 1: Grid Refresh When New Button is Disabled
I have an AutoCrud component where I’ve disabled the “New” button (since I want this to be edit-only for this use case). However, I’m experiencing an unexpected behavior: when I select or unselect an item in the grid that causes the form to open or close, the entire grid refreshes. This doesn’t happen when the “New” button is enabled.
Has anyone else encountered this behavior?
See video:
Issue 2: Adding Custom Buttons to auto-crud-toolbar
I’m looking to add additional custom buttons to the toolbar section that normally contains the “New” button (the auto-crud-toolbar CSS class area). For example, I’d like to add an “Import” button or “Bulk Actions” button alongside the (disabled in this case) existing New buttons.
I’ve looked through the AutoCrud component source and documentation but couldn’t find a clear way to extend the toolbar with custom buttons. Is there a recommended approach for this?
Any guidance on either of these issues would be greatly appreciated!
Did you try adding the New button to the same exact grid? Usually, that flickering is related to a missing useMemo, not to the New button presence.
For the second issue, the toolbar is only added when the New button is present, as there’s no other content to show and an empty toolbar doesn’t render correctly. You can open a feature request in Hilla to allow to add further content, so that the toolbar is created if any content is to be put into it.
You’re right, there’s an issue when the New button is not shown. It seems to me that, when it is shown, the form stays open to allow to add a new item, while this doesn’t happen when creating a new item is not allowed, so the form opens and closes and that triggers flickering.
This is a bug, let me know if you want to open it yourself, otherwise I will.