AutoCrud Component: Grid Refresh Issue and Custom Toolbar Buttons

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!

Thanks!

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.

  1. Just confirmed on the same grid that things work totally fine with the new button enabled.

  2. Understood, will open an issue for this feature request.

Hi, sorry for the wait.

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.

Also, let me move this topic to the Hilla category.

Opened AutoCrud with disabled new button flickers with grid refresh when selecting items · Issue #3996 · vaadin/hilla · GitHub and Toolbar renderer in AutoCrud · Issue #3997 · vaadin/hilla · GitHub, you can join the discussions there.

Thank you very much for opening those issues, and apparently solving them all within the time I was on vacation.

Will test things out with the snapshot build asap.