Call onSelect when a DataSource item changes

Summary:
Currently, we call onSelect in DataTable only when user changes their selection. At that moment, we pass the row data to the `onSelect` callback. However, if later the data changes, but the selection stays the same, we do not call `onSelect` again. As result, any listener to onSelect does not receive the latest data.
In this diff, we start calling `onSelect` when the selection does not change, but the underlying data does.

Reviewed By: mweststrate

Differential Revision: D37520346

fbshipit-source-id: a88d34654e9ad0721caf5918dde49b86ba20fc1f
This commit is contained in:
Andrey Goncharov
2022-06-30 07:01:54 -07:00
committed by Facebook GitHub Bot
parent 1052384154
commit f8763f95fa
7 changed files with 57 additions and 18 deletions

View File

@@ -104,7 +104,8 @@ export function MasterDetail<T extends object>({
// if a tableManagerRef is provided, we piggy back on that same ref
// eslint-disable-next-line
const tableManagerRef = tableProps.tableManagerRef ?? createRef<undefined | DataTableManager<T>>();
const tableManagerRef =
tableProps.tableManagerRef ?? createRef<undefined | DataTableManager<T>>();
const pausedState = useValue(isPaused, false);