DetailsList: Changing onRenderRow/columns props doesn't cause re-render
Environment Information
- Package version(s): (7.76.2)
- Browser and OS versions: (Chrome 80.0.3987.116 (64-bit), Windows 10)
Please provide a reproduction of the bug in a codepen:
The DetailsList component does not re-render when either of its onRenderRow or columns props update. This was raised in a similar issue that was closed because it was marked stale; I'm raising it again because there didn't seem to be a clear solution outcome.
Actual behavior:
DetailsList does not re-render when its props change. It seems to be a common use-case of the onRenderRow prop to apply styling to the rows in the list and it is strange that the rows are not re-rendered when the styling used changes.
Similarly, when the columns provided to the list changes, one would expect for the list to update. This is not the case.
Expected behavior:
The list re-renders when its props change.
We are able to workaround this behavior by using the version prop in listProps, but ideally the component updates as expected without this weird force update.
Priorities and help requested:
Are you willing to submit a PR to fix? (Yes, No)
Yes.
Requested priority: (Blocking, High, Normal, Low)
Normal
Products/sites affected: (if applicable)
@msdehoward Thanks for reaching out to us! I see that @dzearing said this was done to preserve performance (as in shouldComponentUpdate specifically ignores this change and avoids rerendering). In a later comment he offered other workarounds. I believe any fix to this would involve a breaking change and at the moment, we've paused on big changes to DetailsList but I'll add this to the backlog so that when we iterate on DetailsList in the near future, we consider this issue from the design stage.
Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.
Still require assistance? Please, create a new issue with up-to date details.