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

Refactor ThemeProvider #2994

Merged
merged 3 commits into from
Feb 24, 2024

Conversation

adityagarg06
Copy link
Contributor

Progress on #2042

Changes:

  • Replaced the mapStateToProps and connect functions with useSelector to select the desired state.
  • Removed currentTheme from the PropTypes as it is obtained from Redux Store.

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

@lindapaiste
Copy link
Collaborator

FYI I've held off on merging this one because I wanted to see what happened with regards to a problem in the current test code which you may have seen before where the theme value is not always set in the state. That's my mistake -- I wrote some of the test code expecting a deep merge of the Redux state and then we ended up with a shallow merge.

 PASS   client  client/modules/IDE/components/Preferences/Preferences.unit.test.jsx (13.318 s)
  ● Console

    console.error
      Warning: Failed prop type: The prop `currentTheme` is marked as required in `Provider`, but its value is `undefined`.
          in Provider (created by Connect(Provider))
          in Connect(Provider) (created by Wrapper)
          in Provider (created by Wrapper)
          in I18nextProvider (created by Wrapper)
          in Wrapper

      115 |   };
      116 |
    > 117 |   return { store, ...render(ui, { wrapper: Wrapper, ...renderOptions }) };
          |                            ^
      118 | }
      119 |
      120 | /**

I'm going to go ahead and fix that now and merge it into this branch.

@lindapaiste lindapaiste merged commit 64c36ca into processing:develop Feb 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants