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

Pass action to subscribe() listeners #1786

Closed
rstacruz opened this issue Jun 1, 2016 · 1 comment
Closed

Pass action to subscribe() listeners #1786

rstacruz opened this issue Jun 1, 2016 · 1 comment

Comments

@rstacruz
Copy link

rstacruz commented Jun 1, 2016

It'd be nice to be able to learn what actions trigger a subscribe() event:

store.subscribe(action => {
  if (action.type === '...') {
    /* do something */
  }
})

This way you can create listener services that wait for a certain action to do something. Example use case is to send Google Analytics data when ROUTE_CHANGE occurs (assuming your router sends this out).

@markerikson
Copy link
Contributor

This has been suggested several times, and turned down. Use middleware to respond to actions (such as redux-saga).

See #1057 , #1243 , #347 , #1300 , and #580.

brandoncroberts pushed a commit to brandoncroberts/redux that referenced this issue Oct 13, 2023
…s#1786)

* Override unwrap behavior for buildInitiateQuery, update tests
* Update TS test matrix to cover 4.4 and 4.5
* Fix type issue in tests
* Update packages/toolkit/src/query/tests/buildHooks.test.tsx
* Remove intermediate variable for aggregatePromise
* Update packages/toolkit/src/query/core/buildInitiate.ts

Co-authored-by: Lenz Weber <mail@lenzw.de>
Co-authored-by: Mark Erikson <mark@isquaredsoftware.com>
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

No branches or pull requests

2 participants