Hey there,
I just answered a similar post, maybe that could help you out: How to update/reload layout
As @adi mentionned, you can either have layout WITHIN the tab (therefore keeping the layout state) or OUTSIDE the tab (meaning you re-generate the whole layout everytime, amking it harder to keep the data)