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

FEA-1258: Named redux devtools instances #797

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

matthewnitschke-wk
Copy link
Contributor

@matthewnitschke-wk matthewnitschke-wk commented Jan 18, 2023

Motivation

As its currently implemented, we have no way to provide options to the initialization of the overReactReduxDevToolsMiddleware. This pr adds an additional overReactReduxDevToolsMiddlewareFactory which currently only accepts a name parameter (more can be added as needed)

This directly proxies the list of available options which the redux-devtools api provides

Screenshot 2023-01-18 at 11 49 21 AM

Changes

  • exposes new overReactReduxDevToolsMiddlewareFactory to allow constructing a dev tools middleware with a name parameter

Release Notes

Add overReactReduxDevToolsMiddlewareFactory which allows constructing redux dev tools with options

Review

Please review:

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • Manual testing was performed if needed

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

  • A Frontend Frameworks Design member has reviewed these changes
  • There are no unaddressed comments - this check can be automated if reviewers use the "Request Changes" feature
  • For release PRs - Version metadata in Rosie comment is correct

@matthewnitschke-wk matthewnitschke-wk changed the title FEA-1258: Named redux dev tools instances FEA-1258: Named redux devtools instances Jan 18, 2023
@aviary-wf
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@matthewnitschke-wk matthewnitschke-wk marked this pull request as ready for review January 18, 2023 19:11
Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

A couple small things, otherwise looks good to me!

I tried locally (after applying that options default value) with multiple stores and it worked like a charm!

lib/src/over_react_redux/devtools/middleware.dart Outdated Show resolved Hide resolved
lib/src/over_react_redux/devtools/middleware.dart Outdated Show resolved Hide resolved
@@ -193,3 +193,20 @@ class _OverReactReduxDevToolsMiddleware extends MiddlewareClass {
/// );
/// ```
final MiddlewareClass overReactReduxDevToolsMiddleware = _OverReactReduxDevToolsMiddleware();
Copy link
Contributor

Choose a reason for hiding this comment

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

I almost wonder if we should deprecate this in favor of overReactReduxDevToolsMiddlewareFactory, to encourage people to add names. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe eventually

Technically this approach of a middleware factory is not the method that the official redux-devtools uses. Their implementation looks a bit more like:

const composeEnhancers = composeWithDevTools(options);
const store = createStore(
  reducer,
  /* preloadedState, */ composeEnhancers(
    applyMiddleware(...middleware)
    // other store enhancers if any
  )
);

I wasn't sure of the core reasoning behind this, so I felt a bit more comfortable "trying this out" for a bit before we consider it the de-facto way to initialize a dev tools middleware.

If you don't think that's necessary, I'm happy to deprecate and encourage the factory approach

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine by me 👍

@autobot-wf
Copy link

Skynet test results failed initially for this build but were approved by greg.littlefield
https://wf-skynet-hrd.appspot.com/apps/test/smithy/4224131/1
Approval message: only analyzer dev channel build is failing; we can ignore for now

Copy link
Contributor

@greglittlefield-wf greglittlefield-wf left a comment

Choose a reason for hiding this comment

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

  • Changes look good
  • Stores and all their actions show up separately in the dev tools when
    • one store is named and the other is not
    • both stores are named

+10

@Workiva/release-management-p

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

@rmconsole6-wk rmconsole6-wk merged commit 88858c5 into master Jan 18, 2023
@rmconsole6-wk rmconsole6-wk deleted the named_redux_dev_tools_instances branch January 18, 2023 20:47
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.

6 participants