Skip to content

Commit 344b9cc

Browse files
authored
Fix pagination unavailable in connection outside of the workbook (#3038)
1 parent 741a76e commit 344b9cc

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/ui/units/datasets/store/actions/creators/datasetTyped.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,10 +1241,6 @@ export function changeCurrentDbName(payload: string) {
12411241

12421242
export function searchSources(searchValue: string) {
12431243
return async (dispatch: DatasetDispatch, getState: GetState) => {
1244-
dispatch({
1245-
type: DATASET_ACTION_TYPES.SET_SOURCES_SEARCH_LOADING,
1246-
payload: true,
1247-
});
12481244
const state = getState();
12491245
const {sourcesPagination, currentDbName, errors} = state.dataset;
12501246

@@ -1253,13 +1249,15 @@ export function searchSources(searchValue: string) {
12531249

12541250
if (
12551251
!connection?.entryId ||
1256-
!workbookId ||
12571252
errors.sourceLoadingError ||
12581253
sourcesPagination.searchValue === searchValue
12591254
) {
12601255
return;
12611256
}
1262-
1257+
dispatch({
1258+
type: DATASET_ACTION_TYPES.SET_SOURCES_SEARCH_LOADING,
1259+
payload: true,
1260+
});
12631261
batch(async () => {
12641262
dispatch(
12651263
setSourcesPagination({...initialState.sourcesPagination, searchValue: searchValue}),
@@ -1291,10 +1289,6 @@ export function setCurrentDbName(payload: string): SetCurrentDbName {
12911289

12921290
export function incrementSourcesPage() {
12931291
return async (dispatch: DatasetDispatch, getState: GetState) => {
1294-
dispatch({
1295-
type: DATASET_ACTION_TYPES.SOURCES_NEXT_PAGE_REQUEST,
1296-
});
1297-
12981292
const state = getState();
12991293
const connection = selectedConnectionSelector(state);
13001294
const workbookId = workbookIdSelector(state);
@@ -1303,9 +1297,12 @@ export function incrementSourcesPage() {
13031297
dataset: {sourcesPagination, currentDbName, errors},
13041298
} = state;
13051299

1306-
if (!connection?.entryId || !workbookId || errors.sourceLoadingError) {
1300+
if (!connection?.entryId || errors.sourceLoadingError) {
13071301
return;
13081302
}
1303+
dispatch({
1304+
type: DATASET_ACTION_TYPES.SOURCES_NEXT_PAGE_REQUEST,
1305+
});
13091306

13101307
const sources = await dispatch(
13111308
getSources({
@@ -1336,7 +1333,7 @@ export function incrementSourcesPage() {
13361333

13371334
interface GetSourcesProps {
13381335
connectionId: string;
1339-
workbookId: string;
1336+
workbookId: string | null;
13401337
searchText?: string;
13411338
offset?: number;
13421339
currentDbName?: string;

0 commit comments

Comments
 (0)