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

issue-2158/Refactored redux store utility functions #2482

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

KraftKatten
Copy link
Collaborator

Description

This PR is a start of refactoring Redux store utility functions. It creates utility methods such as create, load, loaded, update, updated and deleted for the remoteData data type. So far, the refactoring applies only to the following features:

  • AreaAssignment
  • Areas
  • JoinForms
  • Tags

Next step is to get this code reviewed and approved, and then I'll continue refactoring for other features as well. Another step is to make tests for this.

Screenshots

Only code changes.

Changes

  • Adds utility methods for common Redux store operations

Notes to reviewer

I'll add some comments in the code

Related issues

The issue won't be completely resolved by this PR.

src/features/areaAssignments/store.ts Show resolved Hide resolved
src/features/areaAssignments/store.ts Show resolved Hide resolved
src/features/areaAssignments/store.ts Show resolved Hide resolved
src/features/areaAssignments/store.ts Show resolved Hide resolved
src/features/areaAssignments/store.ts Show resolved Hide resolved
state.areaList.items = state.areaList.items.filter(
(item) => item.id != deletedId
);
remoteItemDeleted(state.areaList, deletedId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as before, now I don't only remove the item from the list, I also set item.deleted = true. Should be ok, right?

src/features/areas/store.ts Outdated Show resolved Hide resolved
src/features/joinForms/store.ts Show resolved Hide resolved
src/features/joinForms/store.ts Show resolved Hide resolved
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.

1 participant