Skip to content

🪟 🧹 Clean up NotificationService imports #22072

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

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airbyte-webapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ConfirmationModalService } from "hooks/services/ConfirmationModal";
import { defaultOssFeatures, FeatureService } from "hooks/services/Feature";
import { FormChangeTrackerService } from "hooks/services/FormChangeTracker";
import { ModalServiceProvider } from "hooks/services/Modal";
import NotificationService from "hooks/services/Notification";
import { NotificationService } from "hooks/services/Notification";
import { AnalyticsProvider } from "views/common/AnalyticsProvider";
import { StoreProvider } from "views/common/StoreProvider";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Notification, NotificationServiceApi, NotificationServiceState } from "

const notificationServiceContext = React.createContext<NotificationServiceApi | null>(null);

const NotificationService = ({ children }: { children: React.ReactNode }) => {
export const NotificationService = React.memo(({ children }: { children: React.ReactNode }) => {
const [state, { addNotification, clearAll, deleteNotificationById }] = useTypesafeReducer<
NotificationServiceState,
typeof actions
Expand Down Expand Up @@ -47,7 +47,7 @@ const NotificationService = ({ children }: { children: React.ReactNode }) => {
) : null}
</>
);
};
});

export const useNotificationService: (
notification?: Notification,
Expand Down Expand Up @@ -80,5 +80,3 @@ export const useNotificationService: (
unregisterAllNotifications: notificationService.clearAll,
};
};

export default React.memo(NotificationService);
2 changes: 2 additions & 0 deletions airbyte-webapp/src/hooks/services/Notification/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { NotificationService, useNotificationService } from "./NotificationService";
export * from "./types";
5 changes: 0 additions & 5 deletions airbyte-webapp/src/hooks/services/Notification/index.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions airbyte-webapp/src/packages/cloud/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ConfirmationModalService } from "hooks/services/ConfirmationModal";
import { defaultCloudFeatures, FeatureService } from "hooks/services/Feature";
import { FormChangeTrackerService } from "hooks/services/FormChangeTracker";
import { ModalServiceProvider } from "hooks/services/Modal";
import NotificationServiceProvider from "hooks/services/Notification";
import { NotificationService } from "hooks/services/Notification";
import en from "locales/en.json";
import { Routing } from "packages/cloud/cloudRoutes";
import cloudLocales from "packages/cloud/locales/en.json";
Expand All @@ -35,7 +35,7 @@ const Services: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
<AnalyticsProvider>
<AppMonitoringServiceProvider>
<ApiErrorBoundary>
<NotificationServiceProvider>
<NotificationService>
<ConfirmationModalService>
<ModalServiceProvider>
<FormChangeTrackerService>
Expand All @@ -51,7 +51,7 @@ const Services: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
</FormChangeTrackerService>
</ModalServiceProvider>
</ConfirmationModalService>
</NotificationServiceProvider>
</NotificationService>
</ApiErrorBoundary>
</AppMonitoringServiceProvider>
</AnalyticsProvider>
Expand Down