Comments (5)
I think we can allow it and let the Reduce
implementation handle that case.
from reduxsimple.
First of all, thanks for the point of view.
My first question is "should we wait for C#8 which will handle null
with ease or should we filter this value now?".
Given your point of view, I get to the conclusion that we should ask this underlying question: "did you ever experience a null
action and in what context?".
from reduxsimple.
My (initial) view on that point is exactly the same as mhusainisurge's: why interfere at all?
If you can allow to pass a new object()
as an action and have the reducers handle it, then null
, DBNull.Value
, 1
, etc. should be treated just the same. That's what a developer with some experience in redux would expect.
However, I can see a problem for new developers who struggle with their jobs. Any NullReferenceException is a problem, many find it hard to trace where the null come from.. Now in redux scheme, where you dispatch actions -anywhere- and they just show up in reducers, a null-action can easily cause a NRE in poorly-written reducers, and then finding the source of that action is something I believe many may have problems with.
So.. I change my opinion:
Although my first reaction was "why interfere? let it pass", and even now I still feel that's the right way to do from the point of view of "redux theory", I suppose that the best way to handle null actions is ... to ignore them.
Conceptually, a null
is nothing, or a "dont know" value, and an action sent to the store should define what to do. A Store receiving null
as action may either pass them to reducers and risk a NRE which may cause a developer some pain, or it can play along the 'nothing' concept and do nothing. No reducer fired, no state change, no store update. A nice thing would be to issue a trace-warning about a null-action received could be issued, as sending a null instead of an action is not a normal thing, but only in DEBUG builds.
from reduxsimple.
@quetzalcoatl I just re-read your post today. Seems I missed the part about a warning in debug mode when the action dispatched is null
. Seems fair and easy to add. I'll add it to my todo list for the 2.1 version.
from reduxsimple.
This is now added in the version 2.1 of ReduxSimple.
https://www.nuget.org/packages/ReduxSimple/2.1.0
from reduxsimple.
Related Issues (20)
- Reliance on Converto / Newtonsoft.Json HOT 3
- Next version with current state HOT 3
- Can ReduxSimple be used in Xamarin Forms Applications? HOT 2
- Prevent Concurrent Dispatch HOT 3
- CI/CD of NuGet packages using GitHub Actions
- Test name error HOT 1
- Effects with async / Task support ? HOT 1
- Exception during effect causing effect to be removed as action handler HOT 14
- How can I wait for all the asynchronous task effects completed when Dispath an action ? HOT 6
- Synchronous Effect leads to strange action ordering HOT 10
- Pass the Store in the CreateEffect function
- Throw exception in reducer will cause ReduxStore stop work for new Dispatch HOT 5
- System.MissingMethodException: 'Method not found: 'System.String Microsoft.Toolkit.Uwp.Helpers.SystemInformation.get_ApplicationName()'.' HOT 2
- Allow DI in Effects HOT 11
- There is an ArgumentException on RemoveAll entity adapter method invocation. HOT 2
- Help with understanding subreducers and nested state HOT 9
- Removing selectors in subscriptions / dependant subscriptions HOT 22
- How install for usage? HOT 1
- Make use of new C#10 features
- Add CreateSlice function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reduxsimple.