-
Notifications
You must be signed in to change notification settings - Fork 34
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
Record refresh bugfix and simple-review enhancement to hide rollback button #3053
Conversation
…ed correctly whenever the collection is modified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 👌
Since this PR covers two commits, please don't squash them 🙏 (also, nitpick we usually use Fix #123:
or (Fixes #123)
to reference issues in commit)
src/locationUtils.ts
Outdated
return [["home", "/"]].concat(zip(crumbNames, crumbPaths)); | ||
} | ||
|
||
// This may become obsolete when upgrading or switching router packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: can we add notes about current/expected versions or upgrade PR number
src/sagas/collection.ts
Outdated
@@ -53,7 +53,7 @@ export function* listRecords( | |||
limit: MAX_PER_PAGE, | |||
}); | |||
// Show list of records. | |||
yield put(actions.listRecordsSuccess(data, hasNextPage, next)); | |||
yield put(actions.listRecordsSuccess(data, hasNextPage, next, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: can we add a little annotation for this false
? like:
yield put(actions.listRecordsSuccess(data, hasNextPage, next, false)); | |
yield put(actions.listRecordsSuccess(data, hasNextPage, next, /* isNextPage: */ false)); |
src/sagas/collection.ts
Outdated
@@ -71,7 +71,7 @@ export function* listNextRecords(getState: GetStateFn): SagaGen { | |||
} | |||
try { | |||
const { data, hasNextPage, next } = yield call(listNextRecords); | |||
yield put(actions.listRecordsSuccess(data, hasNextPage, next)); | |||
yield put(actions.listRecordsSuccess(data, hasNextPage, next, true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
return { | ||
...state, | ||
records: [...state.records, ...records], | ||
records: isNextPage ? [...state.records, ...records] : records, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand this. Maybe isNextPage
does not represent what we are really doing here?
Could you please add a comment why we skip state.records
when isNextPage
?
@@ -57,18 +57,21 @@ export function listNextRecords(): { | |||
export function listRecordsSuccess( | |||
records: RecordData[], | |||
hasNextRecords: boolean, | |||
listNextRecords: Function | null | undefined | |||
listNextRecords: Function | null | undefined, | |||
isNextPage: boolean = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What alternative names would we have for this isNextPage
?
Resolves two issues and adds unit tests around them:
Note: The added the query param is only useful while the user does not navigate away and back. Should this be a change that needs to be persisted throughout the session please leave a comment and I'll adjust the code to save this to sessionStorage and check against that.
Video demos showing fixes:
simplescreenrecorder-2023-11-07_10.25.29.mp4
simplescreenrecorder-2023-11-08_10.13.16.mp4