Git Product home page Git Product logo

Comments (3)

kkwak avatar kkwak commented on May 29, 2024 1

You are absolutely correct. Didn't realize that this was due to casing! I was looking all over the place in the code..

I like Proposal 2 with the warnings.. if it makes a difference.
Additionally, would it be possible to scope the store names? dataSource, grid, etc are very common names.
Would be nice if it was prefixed by rrg-dataSource, rrg-grid, rrg-bulkActions, etc..
As the default for any app would be to provide an existing store.

Thanks for the fast feedback.
Hoping this grid will work for me!

from react-redux-grid.

bencripps avatar bencripps commented on May 29, 2024

@kkwak thanks for posting the issue; I know what the immediate problem is, and it's not your configuration, as you inferred.

The quick fix is this:

Rather than doing as the documentation suggests:

import { Reducers } from 'react-redux-grid';

const myReducers = {
    myCustomReducer,
    ....Reducers
};

Do this:

import { Reducers } from 'react-redux-grid';

const gridReducers = {
    dataSource: Reducers.DataSource,
    editor: Reducers.Editor,
    errorHandler: Reducers.ErrorHandler,
    filter: Reducers.Filter,
    grid: Reducers.grid,
    loader: Reducers.Loader,
    menu: Reducers.Menu,
    pager: Reducers.Pager,
    selection: Reducers.Selection
};

export const rootReducer = combineReducers({
    app,
    ...gridReducers
});

This will fix your issue.

The coming fix for grid

I haven't decided how I'm going to fix this. Currently there are two components that read state out of the store -- the stateGetter utility, and the shouldComponentUpdate function for the central grid
component. The stateGetter function is case insensitive, and thus didn't break, however, the shouldComponentUpdate function isn't case insensitive (yet).

Proposal 1

Make shouldComponentUpdate case insensitive. This is the simpler fix, and it makes the grid more fault protective, but it also slows down performance because it has to normalize values on every function call -- this is mitigated somewhat, by only checking for case sensitivity if the values don't match on first run.

Proposal 2

Update the core exports to correct casing on the reducers => Reducers.DataSource would be Reducers.dataSource. This is the cleaner fix, but it would break current users of the grid.

The Reducer list would look as follows:

const Reducers = {
    dataSource: datasource,
    grid: grid,
    bulkActions: bulkaction,
    editor: editor,
    errorHandler: errorhandler,
    filter: filter,
    loader: loader,
    menu: menu,
    pager: pager,
    selection: selection
};

I'm going to think about this for a couple days before I commit the changes. I also may allow for both for a short time, emitting console warns until the next major release.

Let me know if the fix above doesn't work, but I'm almost certain that's the problem.

from react-redux-grid.

bencripps avatar bencripps commented on May 29, 2024

Awesome! Glad that worked for you. I think I'm going to go with proposal 2, allowing for case insensitivity for the short duration.

Also, I love the idea of namespacing the reducers. However, this will also be a breaking change, so it will need to be made as a separate MR with full documentation of the changes. I will do that after I make the changes for the casing issue.

Thanks!

from react-redux-grid.

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.