-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary: Switching between tabs in the repeater layout causes flickering and loss of form state due to React unmounting/remounting behavior. This affects user experience and data entry reliability.
The original implementation renders only the active tab content:
{ items[ activeItem ] &&
<Content
key={ items[ activeItem ].key ?? activeItem }
className='tf-repeater-tab-content'
>
{ rowFields.map((control, i) => (
<Row key={ control.name ?? i } className='tf-repeater-tab-row'>
{ renderItem(control, items[ activeItem ], activeItem) }
</Row> )) }
</Content> }
I tested rendering all tabs and toggling visibility via display: none.
Changes Tested Locally: assets/src/components/repeater/layout/tab/Tab.jsx
{ items && items.map((item, itemIndex) => (
<Content
key={ item.key ?? itemIndex }
className='tf-repeater-tab-content'
style={{ display: activeItem === itemIndex ? 'block' : 'none' }}
>
{ rowFields.map((control, i) => (
<Row key={ control.name ?? i } className='tf-repeater-tab-row'>
{ renderItem(control, item, itemIndex) }
</Row> )) }
</Content>
)) }
assets/src/components/base/tab/Tab.jsx
const Content = props => (
<div
className={ 'tf-tab-content ' + (props.className ?? '') }
style={ props.style }
>
{ props.children }
</div>
)
Observed Behavior After Patch:
- No flickering when switching tabs
- Input fields retain focus and values
- DOM remains stable
Questions:
- Is this a viable long-term solution?
- Are there performance concerns with rendering all tab contents?
Metadata
Metadata
Assignees
Labels
No labels