GithubHelp home page GithubHelp logo

Comments (5)

mhusainisurge avatar mhusainisurge commented on September 1, 2024 1

I think we can allow it and let the Reduce implementation handle that case.

from reduxsimple.

Odonno avatar Odonno commented on September 1, 2024 1

Hi @quetzalcoatl

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.

quetzalcoatl avatar quetzalcoatl commented on September 1, 2024

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.

Odonno avatar Odonno commented on September 1, 2024

@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.

Odonno avatar Odonno commented on September 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.