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

Correctly Utilize Cache in Tables Flyout #1662

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}: AssociatedObjectsFlyoutProps) => {
const { loadStatus, startLoading } = useLoadTableColumnsToCache();
const [tableColumns, setTableColumns] = useState<CachedColumn[] | undefined>([]);
const [schemaData, setSchemaData] = useState<any>([]);

Check warning on line 68 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const { setToast } = useToast();

const DiscoverButton = () => {
Expand Down Expand Up @@ -104,7 +104,7 @@
);
};

const DetailComponent = (detailProps: { title: string; description: any }) => {

Check warning on line 107 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const { title, description } = detailProps;
return (
<EuiFlexItem>
Expand Down Expand Up @@ -168,7 +168,7 @@
field: 'type',
name: 'Type',
},
] as Array<EuiTableFieldDataColumnType<any>>;

Check warning on line 171 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const noDataMessage = (
<EuiEmptyPrompt
Expand Down Expand Up @@ -220,17 +220,32 @@
name: 'Data Type',
'data-test-subj': 'columnDataType',
},
] as Array<EuiTableFieldDataColumnType<any>>;

Check warning on line 223 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const renderAccelerationDetailsFlyout = getRenderAccelerationDetailsFlyout();

useEffect(() => {
if (tableDetail && !tableDetail.columns) {
startLoading(datasourceName, tableDetail.database, tableDetail.name);
let tables;
try {
tables = CatalogCacheManager.getTable(

Check warning on line 231 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx#L230-L231

Added lines #L230 - L231 were not covered by tests
datasourceName,
tableDetail.database,
tableDetail.name
);
} catch (error) {
console.error(error);
setToast('Your cache is outdated, refresh databases and tables', 'warning');

Check warning on line 238 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx#L237-L238

Added lines #L237 - L238 were not covered by tests
}
if (tables?.columns) {
setTableColumns(tables?.columns);
} else {
startLoading(datasourceName, tableDetail.database, tableDetail.name);

Check warning on line 243 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View check run for this annotation

Codecov / codecov/patch

public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx#L241-L243

Added lines #L241 - L243 were not covered by tests
}
} else if (tableDetail && tableDetail.columns) {
setTableColumns(tableDetail.columns);
}
}, []);

Check warning on line 248 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has missing dependencies: 'datasourceName', 'setToast', 'startLoading', and 'tableDetail'. Either include them or remove the dependency array

useEffect(() => {
if (loadStatus.toLowerCase() === DirectQueryLoadingStatus.SUCCESS) {
Expand All @@ -247,7 +262,7 @@
setToast('Your cache is outdated, refresh databases and tables', 'warning');
}
}
}, [loadStatus]);

Check warning on line 265 in public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has missing dependencies: 'datasourceName', 'setToast', 'tableDetail.database', and 'tableDetail.name'. Either include them or remove the dependency array

useEffect(() => {
setSchemaData(
Expand Down
Loading