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:
committed by
Facebook GitHub Bot
parent
1052384154
commit
f8763f95fa
@@ -66,7 +66,7 @@ export const DataSourceRendererStatic: <T extends object, C>(
|
||||
let unmounted = false;
|
||||
|
||||
dataSource.view.setWindow(0, dataSource.limit);
|
||||
dataSource.view.setListener((_event) => {
|
||||
const unsubscribe = dataSource.view.addListener((_event) => {
|
||||
if (unmounted) {
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ export const DataSourceRendererStatic: <T extends object, C>(
|
||||
|
||||
return () => {
|
||||
unmounted = true;
|
||||
dataSource.view.setListener(undefined);
|
||||
unsubscribe();
|
||||
};
|
||||
},
|
||||
[dataSource, setForceUpdate, useFixedRowHeight],
|
||||
|
||||
Reference in New Issue
Block a user