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

Record refresh bugfix and simple-review enhancement to hide rollback button #3053

Merged
merged 4 commits into from
Nov 13, 2023
Merged

Record refresh bugfix and simple-review enhancement to hide rollback button #3053

merged 4 commits into from
Nov 13, 2023

Conversation

alexcottner
Copy link
Contributor

@alexcottner alexcottner commented Nov 8, 2023

Resolves two issues and adds unit tests around them:

  1. Add query param to hide rollback button
  2. List of records is not refreshed after rollback

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

Copy link
Contributor

@leplatrem leplatrem left a 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)

return [["home", "/"]].concat(zip(crumbNames, crumbPaths));
}

// This may become obsolete when upgrading or switching router packages
Copy link
Contributor

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

@@ -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));
Copy link
Contributor

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:

Suggested change
yield put(actions.listRecordsSuccess(data, hasNextPage, next, false));
yield put(actions.listRecordsSuccess(data, hasNextPage, next, /* isNextPage: */ false));

@@ -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));
Copy link
Contributor

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,
Copy link
Contributor

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
Copy link
Contributor

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?

@alexcottner alexcottner merged commit f7d8ae3 into Kinto:master Nov 13, 2023
@alexcottner alexcottner deleted the record-signoff branch November 14, 2023 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants