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
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -70,7 +76,7 @@ const CatalogTreeComponent: React.FC<React.PropsWithChildren<CatalogTreeProps>>
);

return (
<BulkEditServiceProvider nodes={streams} update={onStreamsChanged}>
<BulkEditServiceProvider nodes={filteredStreams} update={onBatchStreamsChanged}>
<LoadingBackdrop loading={isLoading}>
{mode !== "readonly" && <CatalogTreeSearch onSearch={setSearchString} />}
<div className={classNames(styles.catalogTreeTable, { [styles.newCatalogTreeTable]: isNewTableDesignEnabled })}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useIntl } from "react-intl";

import { Input } from "components/ui/Input";

import { useBulkEditService } from "hooks/services/BulkEdit/BulkEditService";

import styles from "./CatalogTreeSearch.module.scss";

interface CatalogTreeSearchProps {
Expand All @@ -11,10 +13,12 @@ interface CatalogTreeSearchProps {

export const CatalogTreeSearch: React.FC<CatalogTreeSearchProps> = ({ onSearch }) => {
const { formatMessage } = useIntl();
const { isActive } = useBulkEditService();

return (
<div className={styles.searchContent}>
<Input
disabled={isActive}
className={styles.searchInput}
placeholder={formatMessage({
id: `form.nameSearch`,
Expand Down