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

Update action listener middleware to cover additional use cases #1706

Merged
merged 16 commits into from
Nov 8, 2021

Conversation

markerikson
Copy link
Collaborator

@markerikson markerikson commented Nov 7, 2021

This PR updates the action listener middleware based on the changes proposed in #1648 (reply in thread) :

  • Removes the type: "module" line from the listener middleware package.json file to avoid unwanted ESM handling
  • Sets up Jest+TS testing
  • Copies the test file from yet another attempt at actionListenerMiddleware #547
  • Adds additional tests for the matcher and actionPredicate listener overloads
  • Rewrites the internals to track all listeners in a Map<idString, ListenerEntry>
  • Removes the stopPropagation method
  • Renames the When values to 'beforeReducer' and 'afterReducer', and adds an additional 'both' value
  • Wraps listeners in a try/catch to handle errors
  • Hacks in runtime support for an extra value ala thunks, but without good typing
  • Adds a getOriginalState method that captures the state before the action was dispatched
  • Tries and fails to get thunk-typed dispatching working
  • Adds a condition method to enable long-running async workflows, based on https://docs.temporal.io/docs/typescript/workflows/#condition

For any review, please focus on actual code per intent - let's save the bikeshedding for the discussion thread after I get an updated alpha release out :)

@github-actions
Copy link

github-actions bot commented Nov 7, 2021

size-limit report 📦

Path Size
1. entry point: @reduxjs/toolkit (cjs.production.min.js) 12.23 KB (+0.05% 🔺)
1. entry point: @reduxjs/toolkit (esm.js) 10.22 KB (0%)
1. entry point: @reduxjs/toolkit/query (cjs.production.min.js) 20.35 KB (+0.03% 🔺)
1. entry point: @reduxjs/toolkit/query (esm.js) 17.37 KB (0%)
1. entry point: @reduxjs/toolkit/query/react (cjs.production.min.js) 22.22 KB (+0.03% 🔺)
1. entry point: @reduxjs/toolkit/query/react (esm.js) 19.82 KB (0%)
2. entry point: @reduxjs/toolkit (without dependencies) (cjs.production.min.js) 5.56 KB (+0.11% 🔺)
2. entry point: @reduxjs/toolkit (without dependencies) (esm.js) 5.53 KB (0%)
2. entry point: @reduxjs/toolkit/query (without dependencies) (cjs.production.min.js) 9.2 KB (0%)
2. entry point: @reduxjs/toolkit/query (without dependencies) (esm.js) 9.58 KB (0%)
2. entry point: @reduxjs/toolkit/query/react (without dependencies) (cjs.production.min.js) 2.37 KB (0%)
2. entry point: @reduxjs/toolkit/query/react (without dependencies) (esm.js) 2.21 KB (0%)
3. createSlice (esm.js) 5.16 KB (0%)
3. createEntityAdapter (esm.js) 5.83 KB (0%)
3. configureStore (esm.js) 5.83 KB (0%)
3. createApi (esm.js) 15.66 KB (0%)
3. createApi (react) (esm.js) 18.05 KB (0%)
3. fetchBaseQuery (esm.js) 10.93 KB (0%)
3. setupListeners (esm.js) 9.8 KB (0%)
3. ApiProvider (esm.js) 16.99 KB (0%)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 7, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2dd9d01:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration
rsk-github-issues-example Configuration
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration

@markerikson markerikson force-pushed the feature/listener-middleware-enhancements branch 3 times, most recently from a83d884 to e97a03a Compare November 7, 2021 23:54
@markerikson markerikson force-pushed the feature/listener-middleware-enhancements branch from e97a03a to 2dd9d01 Compare November 7, 2021 23:59
@markerikson
Copy link
Collaborator Author

Ignoring the docs failure - another "can't find formik while building the docs" thing that is normally solved by rebuilding docs without cache.

@markerikson markerikson merged commit 3b3a562 into master Nov 8, 2021
@markerikson markerikson deleted the feature/listener-middleware-enhancements branch November 8, 2021 00:14
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