fluttercommunity / fluttercommunity/redux.dart

Exposing a subset of the Store API to middleware

Open
#40 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
519
Forks
57
PR merge metrics
No merged PRs in 30d

Description

This is primarily a question about a difference between the middleware API here versus the JS version.

redux.js exposes only a subset of the Store's API (`getState()` and `dispatch()`) to middleware, whereas redux.dart provides the entire `Store` instance. Are there any valid use cases where having access to `reducer`, `onChange`, or `teardown` justifies their presence?

It seems to me that using those additional Store APIs in middleware would usually be considered anti-patterns and limiting middleware to just the Store's state and dispatcher would be a useful constraint and would make test setups a bit simpler (although this might be a marginal improvement, at best).

Obviously this would be a breaking API change, and the benefit of preventing misuse in middleware and aligning with redux.js is relatively small, so I definitely understand if you decide the juice isn't worth the squeeze. Maybe something to consider in the future if you have other reasons for a new major version.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.