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

Port ReviewEntries to use redux-toolkit #2800

Merged
merged 11 commits into from
Dec 5, 2023

Conversation

imnasnainaec
Copy link
Collaborator

@imnasnainaec imnasnainaec commented Nov 30, 2023

Closes #1953


This change is Reviewable

@imnasnainaec imnasnainaec added frontend maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. goal: ReviewEntries labels Nov 30, 2023
@imnasnainaec imnasnainaec self-assigned this Nov 30, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (7c70504) 72.62% compared to head (29ee966) 72.66%.

Files Patch % Lines
.../goals/ReviewEntries/Redux/ReviewEntriesActions.ts 72.72% 6 Missing ⚠️
src/goals/DefaultGoal/BaseGoalScreen.tsx 0.00% 1 Missing ⚠️
src/goals/ReviewEntries/index.tsx 50.00% 1 Missing ⚠️
src/store.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2800      +/-   ##
==========================================
+ Coverage   72.62%   72.66%   +0.03%     
==========================================
  Files         253      253              
  Lines        9473     9479       +6     
  Branches     1094     1093       -1     
==========================================
+ Hits         6880     6888       +8     
+ Misses       2269     2266       -3     
- Partials      324      325       +1     
Flag Coverage Δ
backend 82.91% <ø> (-0.14%) ⬇️
frontend 63.20% <80.85%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@imnasnainaec imnasnainaec marked this pull request as ready for review November 30, 2023 22:08
@imnasnainaec imnasnainaec requested a review from jmgrady November 30, 2023 22:08
@imnasnainaec imnasnainaec marked this pull request as draft December 1, 2023 13:00
@imnasnainaec imnasnainaec marked this pull request as ready for review December 1, 2023 13:59
Copy link
Collaborator

@jmgrady jmgrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 9 of 12 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @imnasnainaec)


src/goals/ReviewEntries/Redux/ReviewEntriesActions.ts line 43 at r2 (raw file):

}

interface wordUpdate {

I thought interfaces are supposed to be in Pascal Case, that is, WordUpdate.

Code quote:

wordUpdate

src/goals/ReviewEntries/Redux/ReviewEntriesActions.ts line 81 at r2 (raw file):

 * * If a sense is marked as deleted or is utterly blank, it is removed
 * * If a sense lacks gloss, return error
 * * If the user attempts to delete all senses, return old senses with deleted senses removed */

If I understand the comment changes, this is a move to use JSDoc function descriptions. If so, bullets should be - instead of *.

In addition, JSDoc comments should have @param descriptions for a function with parameters passed in.

This also applies to the other functions here.

If the goal is not to migrate the TypeScript code to use JSDoc comments, then I find this style more difficult to read (just a personal preference - I am fine with moving to JSDoc if it allows us to generate documents that will be useful to developers).

Code quote:

/** Returns a cleaned array of senses ready to be saved (none with .deleted=true):
 * * If a sense is marked as deleted or is utterly blank, it is removed
 * * If a sense lacks gloss, return error
 * * If the user attempts to delete all senses, return old senses with deleted senses removed */

src/goals/ReviewEntries/Redux/ReviewEntriesActions.ts line 223 at r2 (raw file):

}

export function deleteAudio(

If the goal is to provide JSDoc function descriptions, deleteAudio and uploadAudio need descriptions of the function and its parameters.

Code quote:

export function deleteAudio(

src/goals/ReviewEntries/Redux/tests/ReviewEntriesActions.test.tsx line 109 at r2 (raw file):

        },
      });
      expect(store.getState().reviewEntriesState.sortBy).toEqual(colId);

These calls to expect are really testing configureStore from @reduxjs/toolkit. They are not needed before dispatching deleteWord.

This comment applies to the other tests as well.

Suggestion:

      expect(store.getState().reviewEntriesState.sortBy).toEqual(colId);
      expect(store.getState().reviewEntriesState.words).toHaveLength(1);

Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 8 of 13 files reviewed, 2 unresolved discussions (waiting on @jmgrady)


src/goals/ReviewEntries/Redux/ReviewEntriesActions.ts line 43 at r2 (raw file):

Previously, jmgrady (Jim Grady) wrote…

I thought interfaces are supposed to be in Pascal Case, that is, WordUpdate.

Done.


src/goals/ReviewEntries/Redux/ReviewEntriesActions.ts line 81 at r2 (raw file):

Previously, jmgrady (Jim Grady) wrote…

If I understand the comment changes, this is a move to use JSDoc function descriptions. If so, bullets should be - instead of *.

In addition, JSDoc comments should have @param descriptions for a function with parameters passed in.

This also applies to the other functions here.

If the goal is not to migrate the TypeScript code to use JSDoc comments, then I find this style more difficult to read (just a personal preference - I am fine with moving to JSDoc if it allows us to generate documents that will be useful to developers).

Switch from * * to * -.

I didn't have JSDocs in view, but simple that VSCode provides /** pre-function comment * information when you hover over that function wherever it's being used. (I supposed that's using JSDocs under the hood.)


src/goals/ReviewEntries/Redux/tests/ReviewEntriesActions.test.tsx line 109 at r2 (raw file):

Previously, jmgrady (Jim Grady) wrote…

These calls to expect are really testing configureStore from @reduxjs/toolkit. They are not needed before dispatching deleteWord.

This comment applies to the other tests as well.

Done.

Copy link
Collaborator

@jmgrady jmgrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)

@imnasnainaec imnasnainaec merged commit 3e61ac7 into master Dec 5, 2023
17 checks passed
@imnasnainaec imnasnainaec deleted the redux-toolkit-review-entries branch December 5, 2023 13:42
jmgrady added a commit that referenced this pull request Feb 28, 2024
jmgrady pushed a commit that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend goal: ReviewEntries maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redux state is being set directly rather than by Redux
3 participants