Skip to content

Commit

Permalink
fix (console): Invalidate metadata global hook cache after tracking/u…
Browse files Browse the repository at this point in the history
…ntracking GDC tables

PR-URL: hasura/graphql-engine-mono#7308
GitOrigin-RevId: bdb81c162bb6bf489464201907e75571920b129f
  • Loading branch information
vijayprasanna13 authored and hasura-bot committed Dec 16, 2022
1 parent 55307f1 commit 32b5672
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion console/src/features/Data/TrackTables/hooks/useTrackTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMetadataMigration } from '@/features/MetadataAPI';
import { useFireNotification } from '@/new-components/Notifications';
import React, { useCallback } from 'react';
import { useQueryClient } from 'react-query';
import { useInvalidateMetata } from '@/features/hasura-metadata-api';
import { useIsUnmounted } from '@/components/Services/Data';
import { useMetadataSource, tablesQueryKey } from '@/features/Data';
import type { TrackableTable } from '../types';
Expand All @@ -17,6 +18,7 @@ export const useTrackTable = (dataSourceName: string) => {
const unMounted = useIsUnmounted();

const { data } = useMetadataSource(dataSourceName);
const invalidateMetadata = useInvalidateMetata();

const metadata = data?.metadata;

Expand Down Expand Up @@ -76,7 +78,7 @@ export const useTrackTable = (dataSourceName: string) => {
'trackTables',
'metadataSource',
]);

invalidateMetadata();
fireNotification({
title: 'Success',
message: `${noun} ${verb} ${action}ed`,
Expand Down

0 comments on commit 32b5672

Please sign in to comment.