Skip to content

Commit 8db7335

Browse files
committed
Fix bug preventing paginator from working on first load
The paginator widget in the changeset list sidebar had an odd behavior where the prev/next arrows did not work after initial page load, and would only start working once you clicked on a specific page number (e.g '2'). Turns out this is because of some sneaky square brackets in one of the Redux selectors which caused pageIndex to be accidentally converted into an array `[0]`. The expression `[0] + 1` evaluates to the string `"01"` in JavaScript (of course it does), resulting in the frontend trying to fetch page `01`, then `011`, then `0111`, etc on each subsequent click of the next button, none of which would succeed.
1 parent c0a16df commit 8db7335

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/store/changesets_page_actions.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ export const locationSelector = (state: RootStateType) =>
5050

5151
/** Sagas **/
5252

53-
export const pageIndexSelector = (state: RootStateType) => [
54-
state.changesetsPage.getIn(['pageIndex'], 0)
55-
];
53+
export const pageIndexSelector = (state: RootStateType) =>
54+
state.changesetsPage.getIn(['pageIndex'], 0);
5655
export const tokenSelector = (state: RootStateType) => state.auth.get('token');
5756

5857
export const aoiIdSelector = (state: RootStateType) =>

0 commit comments

Comments
 (0)