Skip to content

Remove duplicate document.body.className effect #2170

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

Merged
merged 3 commits into from
May 3, 2023

Conversation

lindapaiste
Copy link
Collaborator

Code cleanup 🧹
The components AccountView, CollectionView and DashboardView are all rendered inside of the App component. They do not need to set the document.body.className because this is already handled by the parent App.

Changes:
In all 3 components:

  • removed lifecycle effect:
componentDidMount() {
    document.body.className = this.props.theme;
}
  • removed theme from propTypes declaration
  • removed theme from mapStateToProps

In AccountView only:

  • converted to a function component to fix the ESLint error react/prefer-statelesss-function which popped up after deleting the componentDidMount function.
  • used react-redux hooks instead of connect as a bunch of the properties in mapStateToProps were not actually used.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

@raclim raclim merged commit 5471f8a into processing:develop May 3, 2023
@lindapaiste lindapaiste deleted the fix/document-theme branch May 3, 2023 18:08
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