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

useAppSelector #414

Merged
merged 4 commits into from
Feb 14, 2024
Merged

useAppSelector #414

merged 4 commits into from
Feb 14, 2024

Conversation

benwaples
Copy link
Contributor

Description

This PR mostly improves types so that we dont have to specify AppState every time we use useSelector. There are a couple of changes to support the more accurate types but nothing that changes functionality.

Motivation and Context

Using useAppSelector instead of the generic useSelector reduces imports, slightly increases readability, and helps make sure we use types from the redux store. There are a couple places in the app where we use the any type for redux state which isnt ideal.

How Has This Been Tested?

Regression testing any non type-only changes and updated unit tests.

Screenshots (if appropriate): n/a

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Documentation updates are needed, and have been made accordingly.
  • I have added and/or updated tests to cover my changes.
  • All new and existing tests passed.
  • My changes include a database migration.

@@ -72,7 +70,8 @@ const GroupManagement = () => {
};
});
};

console.log('globalDomain', globalDomain);
if (!globalDomain) return null;
Copy link
Contributor Author

@benwaples benwaples Feb 13, 2024

Choose a reason for hiding this comment

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

globalDomain is initiated as null so it doesnt hurt to have this check. Also, TS wants globalDomain: Domain to pass to GroupManagementContent.

@benwaples benwaples self-assigned this Feb 13, 2024
@benwaples benwaples changed the title add and use useAppSelector useAppSelector Feb 14, 2024
@benwaples benwaples merged commit 95ba244 into main Feb 14, 2024
3 checks passed
@benwaples benwaples deleted the useAppSelector branch February 14, 2024 20:53
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants