lundegaard / redux-tools Goto Github PK
View Code? Open in Web Editor NEWšŖ Maintaining large Redux applications with ease.
Home Page: https://redux-tools.js.org
License: MIT License
šŖ Maintaining large Redux applications with ease.
Home Page: https://redux-tools.js.org
License: MIT License
currently, its way too easy to do const updateSomething = makeSimpleActionCreator(UPDATE_SOMETHING)
and dispatch updateSomething()
accidentally.
this will just break stuff. the user should be notified with the following message
You did not pass an argument to an action creator created by `"makeSimpleActionCreator(${type})"`. Did you mean to use `"makeConstantActionCreator(${type})"`?
šØ You need to enable Continuous Integration on Greenkeeper branches of this repository. šØ
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didnāt receive a CI status on the greenkeeper/initial
branch, itās possible that you donāt have CI set up yet.
We recommend using:
If you have already set up a CI for this repository, you might need to check how itās configured. Make sure it is set to run on all new branches. If you donāt want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, youāll need to re-trigger Greenkeeperās initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
after #92 is implemented
In order to improve DX, the code should look like e.g.:
const withMiddleware = makeInjector(
'Middleware',
prop('injectMiddleware'),
prop('ejectMiddleware')
);
makeBinaryActionCreator
)makeMiddleware
and composeMiddleware
to middleware
(makeMiddleware
will not be added because it is too specific, perhaps in another issue)scopeReducer
to reducers
(not added, but no longer necessary due to #155)useNamespacedSelector
(optional feature arg) to @redux-tools/namespaces-react
Instead, another option could be added: requireNamespace
, which would trigger the same warning/error if a namespace is not received.
Provide READMEs to every package.
this is useful for affecting all widgets from a single widget (must be mentioned in the docs!)
attachNamespace(null, action)
might work, but i think there should be an explicit function for this.
we should ensure that any mechanism where the namespace can be overridden is using defaultNamespace
(notably actions dispatched via namespacedConnect
, injected middleware, epics)
defaultNamespace
should include tests checking that if an action has namespace: null
, it won't be changed
is namespace: null
sufficient? perhaps a constant would be better.
proposed names for the function:
unsetNamespace
removeNamespace
dissocNamespace
detachNamespace
the issue with these names is that the behaviour is not reflected in the name. we are not unsetting a present namespace. we are preventing a namespace to be set automatically.
maybe something like
globalizeAction
preventNamespace
i'm inclining towards preventNamespace
having an explicit constant (NAMESPACE_PREVENTED
)
they should be composed with all the reducers
We call middleware(reduxAPI)(next)
per each action. This is wrong, each middleware should only be initialized once and then we should only call something(action)
use of makeActionTypes is discouraged because of no IDE autocompletion. can this be solved by TS typings in Vanilla JS apps?
if not, makeActionTypes
should be deprecated imo
in EJECTED, payload is null if the injectable is a function. we should pass function.name
instead in both INJECTED and EJECTED
If I have a middleware which turns my dispatched actions into promises, I want to be able to get that promise back dispatching action eg.:
const promise = dispatch(action())
but because of makeEnhancer from @redux-tools/middleware, it always returns undefined instead of promise.
Is this an expected behavior? I would expect that after ejecting reducer (in other words, once the component which contains withReducers() is unmounted), reducer data from store should be removed, right? And if not so, there should be at least option to do so.
Because otherwise, if there is an middleware which adds items on fired action, it will created duplicated data.
Thanks in advance.
Copy pasted from an internal project:
{
someModule: {
common: {}, // App bound
someView: {}, // View bound
}
}
but when you navigate from SomeView to OtherView, you would get
{
someModule: {
common: {}, // App bound - preserved across navigation
otherView: {}, // View bound - fresh initialized
// someView gets dropped
}
}
Of course the same can be achieved by using prefixed names like someModuleCommon or someModuleSomeView, but the nested variant looks nicer.š
we should compose the reducers somehow
šØ You need to enable Continuous Integration on Greenkeeper branches of this repository. šØ
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didnāt receive a CI status on the greenkeeper/initial
branch, itās possible that you donāt have CI set up yet.
We recommend using:
If you have already set up a CI for this repository, you might need to check how itās configured. Make sure it is set to run on all new branches. If you donāt want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, youāll need to re-trigger Greenkeeperās initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
redux-tools might have problems wrt. building application bundles ā if a redux-tools package requires e.g. ^0.26.1
version of ramda, and an application has 0.25.0
as a dependency, two copies of ramda will be included in the final bundle
Hey, it seems that with usage of withReducers(), the initial state passed during store initialization is ignored.
Typical use case is for reason of local storage to set reducer state:
Instead, I should be doing something like this:
Ideally, there could be api to provide initial state together withReducers() HOC?
Thanks in advance.
Provider is not something we depend on for the injection mechanism anymore (because we use the React Redux context instead)
because the Provider is tied to namespacing only, it should be moved to its own package
especially in middlewares
namespaces-react
should contain NamespaceProvider
, useNamespace
, namespacedConnect
makeReducer
should be moved to reducers
getStateByAction
and getStateByNamespace
should be moved to namespaces
After injecting either a reducer or a middleware redux-devtools-extension
stops the logging of actions.
Fix is to set options to devtools like that:
const composeEnhancers = composeWithDevTools({
// NOTE: if not set the extension breaks after injecting reducers
latency: 0,
// NOTE: if `true` extension breaks after injecting reducers
shouldHotReload: false,
});
I think it would be useful to warn our precious users about that.
Mainly wrt. async mode.
Suppose a component's constructor was called, but the component isn't mounted after all (possible situation in async mode). It is not yet known if componentWillUnmount
will fire. This would make it impossible to reliably eject injectables without any leaks.
Injecting in componentDidMount
has a single disadvantage: inner components' componentDidMount
methods are fired first, so a common pattern of e.g. fetching data would not work, because the reducer/epic/middleware would not have been mounted yet.
Microsoft's solution uses state to delay rendering of inner components, which would also work in our case.
There are a couple of possible problems:
componentDidMount
, we would've expected the child component to be mounted, but the mount is actually delayed.)In order to have preloading of content in SSR possible at all, the injectables have to be defined statically and mounted in e.g. async getInitialProps
. Because of our entry system, we do not have to worry about duplicates. When rendering on the client, injectable IDs have to be passed to from the server (somehow) and then injected BEFORE rendering the React application. The injector state (whether componentDidMount
should be delayed) should thus depend on whether the injectable is already injected (resulting in no flashes).
It should also be noted that regardless of async mode behaviour, this approach is cleaner, because no side effects happen in the constructor (and everything can be rewritten to use hooks... perhaps). We'll also be able to get rid of all the versions (finally).
possibly even arrays of action types. this should be possible:
makeReducer([
[ActionType, reducer],
[[ActionTypeOne, ActionTypeTwo], reducer],
[isSomeActionType, reducer]
])
The Redux implementation is too opinionated, because it assumes that the state structure is always static ā if we inject/eject reducers dynamically, state can be lost. Furthermore, combineReducers
does not allow any other keys (they are ignored), which is especially painful for rehydration of state when the appropriate reducers are not mounted yet (state gets lost)
makeActionTypes, options for decorators
it also shouldn't store keys when using an array. current implementation makes it way too easy to inject an epic/middleware twice
Momentarily there is just "^5.1.0". We now support v6 as in #17.
Currently, whenever an action goes through a namespaced middleware, it is immediately associated with that namespace, which doesn't make sense. Only actions dispatched within the middleware should do so.
The fix is either to somehow wrap dispatch to assoc the action, or expose attachNamespace more and make it more aggressive.
https://github.com/lundegaard/redux-tools/blob/master/packages/middleware/src/makeEnhancer.js#L12
This memoization is useless, it needs to be hoisted up so it only runs once
https://bundlephobia.com/result?p=@redux-tools/[email protected] shows a warning about missing deps
i think we should help the existing tools by specifying the transitive peerDependencies manually in all exported packages
we should also check the peerDependencies of all other packages to see if there are any discrepancies
to avoid "value is not a function" errors, which are undecipherable
šØ You need to enable Continuous Integration on Greenkeeper branches of this repository. šØ
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didnāt receive a CI status on the greenkeeper/initial
branch, itās possible that you donāt have CI set up yet.
We recommend using:
If you have already set up a CI for this repository, you might need to check how itās configured. Make sure it is set to run on all new branches. If you donāt want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, youāll need to re-trigger Greenkeeperās initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
The actual state of packages is just proof of concept that rollup
can be used within monorepo.
Please provide real packages and remove old ones.
Would be possible to have both words of the title of the library "Redux Tools" on the same line?
I think it would be nicer on the web.
If you provide a source file I can change it myself.
Also, the transparent background would be more flexible.
šØ You need to enable Continuous Integration on Greenkeeper branches of this repository. šØ
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didnāt receive a CI status on the greenkeeper/initial
branch, itās possible that you donāt have CI set up yet.
We recommend using:
If you have already set up a CI for this repository, you might need to check how itās configured. Make sure it is set to run on all new branches. If you donāt want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, youāll need to re-trigger Greenkeeperās initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
The current version is incompatible with react-redux v6. Because of HOC withInjectorContext
, where the store is passed down the props.
Instead of using feature = "namespaces"
everywhere, it should at least be a constant (or make sure to only default possible user entry points).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.