java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.component.Component.getElement()" because "recreatedComponent" is null

In the code, I simply want to update specific value from the item in a CollectionContainer. Code snippets below.

for (PayrollItem item : payrollItemsDc.getMutableItems()) {
    if (item.getItem().equals(getEditedEntity().getPayrollItem())) {
        item.setPaymentDate(LocalDateTime.now());

        break;
    }
}

But I keep getting following error. Any idea why?

java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.component.Component.getElement()" because "recreatedComponent" is null
	at com.vaadin.flow.data.provider.AbstractComponentDataGenerator.refreshData(AbstractComponentDataGenerator.java:51) ~[flow-data-24.1.12.jar:24.1.12]
	at com.vaadin.flow.data.provider.CompositeDataGenerator.lambda$refreshData$2(CompositeDataGenerator.java:62) ~[flow-data-24.1.12.jar:24.1.12]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at com.vaadin.flow.data.provider.CompositeDataGenerator.refreshData(CompositeDataGenerator.java:62) ~[flow-data-24.1.12.jar:24.1.12]
	at com.vaadin.flow.data.provider.CompositeDataGenerator.lambda$refreshData$2(CompositeDataGenerator.java:62) ~[flow-data-24.1.12.jar:24.1.12]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at com.vaadin.flow.data.provider.CompositeDataGenerator.refreshData(CompositeDataGenerator.java:62) ~[flow-data-24.1.12.jar:24.1.12]
	at com.vaadin.flow.data.provider.DataCommunicator.refresh(DataCommunicator.java:391) ~[flow-data-24.1.12.jar:24.1.12]
	at io.jmix.flowui.component.delegate.AbstractGridDelegate.itemsValueChanged(AbstractGridDelegate.java:215) ~[jmix-flowui-2.1.1.jar:na]
	at io.jmix.flowui.kit.event.EventBus.fireEvent(EventBus.java:82) ~[jmix-flowui-kit-2.1.1.jar:na]
	at io.jmix.flowui.data.grid.ContainerDataGridItems.containerItemPropertyChanged(ContainerDataGridItems.java:76) ~[jmix-flowui-2.1.1.jar:na]
	at io.jmix.core.common.event.EventHub.publish(EventHub.java:172) ~[jmix-core-2.1.1.jar:na]
	at io.jmix.flowui.model.impl.InstanceContainerImpl.itemPropertyChanged(InstanceContainerImpl.java:182) ~[jmix-flowui-2.1.1.jar:na]
	at io.jmix.flowui.model.impl.CollectionContainerImpl.itemPropertyChanged(CollectionContainerImpl.java:228) ~[jmix-flowui-2.1.1.jar:na]
	at io.jmix.core.entity.BaseEntityEntry.firePropertyChanged(BaseEntityEntry.java:198) ~[jmix-core-2.1.1.jar:na]
	at io.jmix.core.impl.EntityInternals.fireListeners(EntityInternals.java:90) ~[jmix-core-2.1.1.jar:na]

It’s hard to say anything definitive from this piece of code…

I can guess that the paymentDate attribute should be displayed on the screen and have an associated UI component.
But at the moment when the code item.setPaymentDate(LocalDateTime.now()) is executed, this UI component for paymentDate has not yet been initialized.