Coder Social home page Coder Social logo

Thank you about reselect-tools HOT 4 CLOSED

skortchmark9 avatar skortchmark9 commented on May 24, 2024 5
Thank you

from reselect-tools.

Comments (4)

trungdq88 avatar trungdq88 commented on May 24, 2024 1

I was always thinking about building something like this (maybe around a year ago) but never putting real effort to do it. Yesterday I decided to give another try, and somehow find this, incredible.

image
(I screenshot this to show my excitement with co-workers last night)

I integrated and it immediately brings benefits to my last project by saving my time debugging selectors input/output. My next project will definitely use this, I can foresee this saves me tons of time debugging and console.loging.

My most favorite features:

  • Clicking to a node highlights it dependences and dependents.
  • Work with "time travel" feature in Redux Devtool (using slider)!
  • Showing recompute count for each selectors.

If there is anything I could help, here are some feedbacks:

  1. Exception handling: Sometimes it shows "Could not load selector graph", I figure out it is because __RESELECT_TOOLS__.selectorGraph() was throwing exceptions (null handling issue in selector logic), after fixing it all, I could get the graph rendered nicely. To improve this, I we should have a try/catch in this line https://github.com/skortchmark9/reselect-tools/blob/master/src/index.js#L59 and then in the output panel, we can show the exception detail.
  2. Selector name conflict: We should somehow supports namespace to avoid naming conflict (many selectors could have a same name in large apps). I was doing this:
const withNamespace = (namespace, selectors) => {
  const keys = Object.keys(selectors);
  const newObj = {};
  keys.forEach(key => {
    newObj[namespace + '/' + key] = selectors[key];
  });
  return newObj;
};

ReselectTools.registerSelectors({
  ...withNamespace('auth', selectors1),
  ...withNamespace('tnx', selectors2),
});

We should consider adding a built-in API to register selectors with namespace.

  1. We could arrange the graph nicer, need some spacing for the selector names.
  2. Could be nicer if we can somehow resolve the selector names without registerSelectors for each selectors files (less step) - I don't know how yet but I can "feel" we can do that.

I could send PR if you have a contribution guide.

from reselect-tools.

skortchmark9 avatar skortchmark9 commented on May 24, 2024 1

Wow so helpful! Thanks dude! These are all really great ideas. I'd take a PR for basically any of them - I don't have a contribution guide but I'd be down to do a code review. I'd just ask that:

  • you keep the test coverage about where it is
  • update the README to document any new features/api you add.

I thought quite a bit about 4.) and I couldn't think of a good way to do it that would work in a minified / uglified build. If you're not minifying, then you can get pretty far doing introspection on the function name, or on the names of the arguments of a descendant selector.

from reselect-tools.

skortchmark9 avatar skortchmark9 commented on May 24, 2024

Awwww how nice! Are you using it in your app? Did you solve any problems with it?

from reselect-tools.

skortchmark9 avatar skortchmark9 commented on May 24, 2024

Of these four, I think the most necessary improvement is the exception handling in selectorGraph(). I've definitely seen selector exceptions be swallowed before in unpleasant ways and it would be great to expose them better. I'll break off a new issue for that, but I'm going to close this one down.

from reselect-tools.

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.