Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 🐛 Fixes BulkEditServiceProvider to use filtered streams instead of all streams #21902

Merged
Prev Previous commit
Next Next commit
Fixes CatalogTree streams updating while filtering streams by search …
…input
  • Loading branch information
YatsukBogdan1 committed Jan 31, 2023
commit ae0bc18a2723b38480e28a0e55f70c088b0ec423
Original file line number Diff line number Diff line change
@@ -30,6 +30,12 @@ const CatalogTreeComponent: React.FC<React.PropsWithChildren<CatalogTreeProps>>

const [searchString, setSearchString] = useState("");

const onBatchStreamsChanged = useCallback(
(newStreams: SyncSchemaStream[]) =>
onStreamsChanged(streams.map((str) => newStreams.find((newStr) => newStr.id === str.id) ?? str)),
[streams, onStreamsChanged]
);

const onSingleStreamChanged = useCallback(
(newValue: SyncSchemaStream) => onStreamsChanged(streams.map((str) => (str.id === newValue.id ? newValue : str))),
[streams, onStreamsChanged]
@@ -70,7 +76,7 @@ const CatalogTreeComponent: React.FC<React.PropsWithChildren<CatalogTreeProps>>
);

return (
<BulkEditServiceProvider nodes={filteredStreams} update={onStreamsChanged}>
<BulkEditServiceProvider nodes={filteredStreams} update={onBatchStreamsChanged}>
<LoadingBackdrop loading={isLoading}>
{mode !== "readonly" && <CatalogTreeSearch onSearch={setSearchString} />}
<div className={classNames(styles.catalogTreeTable, { [styles.newCatalogTreeTable]: isNewTableDesignEnabled })}>