Skip to content

Commit

Permalink
Merge pull request #6845 from hasura/manas/NDAT-320-2-15-backport
Browse files Browse the repository at this point in the history
(2.15 backport) console: refactored browse rows to refetch on every table name change

GitOrigin-RevId: dff7dfe9dae2855631c3f55744c6d5ba72c07e61
  • Loading branch information
manasag authored and hasura-bot committed Nov 14, 2022
1 parent 78b9467 commit 65ea266
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export const TableBrowseRowsContainer = (
return () => {
dispatch(vSetDefaults());
};
// This effect only needs to run once and only needs the table name ref for that time alone
}, []);
}, [tableName]);

const schemas = useAppSelector<Table[]>(store => store.tables.allSchemas);
const {
Expand Down
22 changes: 12 additions & 10 deletions console/src/components/Services/Data/TableBrowseRows/ViewRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,16 +955,18 @@ const ViewRows = props => {
const paginationProps = {};
if (useCustomPagination) {
paginationProps.PaginationComponent = () => (
<PaginationWithOnlyNavContainer
limit={curFilter.limit}
offset={curFilter.offset}
onChangePage={handlePageChange}
onChangePageSize={handlePageSizeChange}
pageSize={curFilter.size}
rows={curRows}
tableSchema={tableSchema}
userQuery={userQuery}
/>
<div className="max-w-5xl">
<PaginationWithOnlyNavContainer
limit={curFilter.limit}
offset={curFilter.offset}
onChangePage={handlePageChange}
onChangePageSize={handlePageSizeChange}
pageSize={curFilter.size}
rows={curRows}
tableSchema={tableSchema}
userQuery={userQuery}
/>
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const LegacyRunQueryContainer = ({
columns={tableColumns}
operators={tableOperators}
onExport={onExportData}
key={`${dataSourceName}-${JSON.stringify(table)}-filters`}
onSubmit={(values: FiltersAndSortFormValues) => {
const userQuery = filterValidUserQuery(
adaptFormValuesToQuery(values, tableColumns)
Expand Down

0 comments on commit 65ea266

Please sign in to comment.