-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Roadmap: RTK v1.3.0 #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Additionally:
|
@markerikson how about using |
@chybisov : I'm not sure what you mean by "common naming". The https://redux.js.org/recipes/structuring-reducers/normalizing-state-shape So no, I don't see any reason to change that. |
@markerikson I mean standard way to name such things. In database world we have entities and keys to this entities. Pretty straightforward names. Key is more generic name, than id, it would be better. btw @ngrx/entity already uses keys as variable name in a lot of place, I don't know why they not change the main one. I think most people just don't care :) but for consistency it would be just great. |
I feel like |
I'm inclined to punt on the new Immer version for now. Whenever it comes out, it's probably worth its own separate update, probably 1.4.0. Removing that from the list. |
Throwing this here for now because I don't want to open another issue atm. Someone on Reddit showed some interesting notional syntax for generating async action types inside of https://i.imgur.com/kcJUcxd.png const someSlice = createSlice({
name: "slice",
initialState,
reducers: {
fetchItems: {
success(state, action) {}
}
}
}) Not sold on it, but it does go along with us already having an object notation for |
I'd +1 this suggestion - personally using sagas and no thunks and I ended up wrapping I quite like how it feels in development, but my API is a tad bit awkward, not to mention I had to do the same thing with reducers (yeah, wrapping I'm pretty confident it could be done though, and having this as a core feature of RTK would be awesome for those of us who use sagas, observables or similar, instead of thunks :) |
I love the I think that a couple more selectors could be added to it though. Namely What do you think? |
@CosmaTrix @markerikson it would be very useful, especially selecting some object by id or some other property. |
Yeah, I'd definitely been thinking about adding a |
@markerikson Yup, that's my idea. // types
selectOne: (state: V, id: EntityId) => T | undefined
selectMany: (state: V, ids: EntityId[]) => Dictionary<T>
// examples
selectors.selectOne(state, 1);
selecttors.selectMany(state, [1, 2, 5]); I've cloned the repo today and played a little bit with the source code. I've added, typed and tested |
I wouldn't expect My main question for this is the typical memoization issue. Notionally, an implementation of const selectMany = createSelector(
selectEntities,
(state, ids) => ids,
(entities, ids) => ids.map(id => entities[id])
) The problem is that a typical usage pattern like (This has always been the weakest aspect of Reselect. Since it only caches the latest calculated value, changing the inputs causes recalculations, which can both be expensive in terms of transformation cost, and returning new references as a result typically causes re-renders at the UI level.) The current list of generated selectors doesn't have to worry about that, because the only inputs are the Not saying we can't add it, but it's a usage nuance that gets tricky. |
Tell you what. I'll go ahead and add |
@markerikson You're so right! Both about the return type of my |
Yeah, just put that out in https://github.com/reduxjs/redux-toolkit/releases/tag/v1.3.0-beta.1 . |
v1.3.0 is now LIVE! https://github.com/reduxjs/redux-toolkit/releases/tag/v1.3.0 We don't have the usage guide docs for |
v1.3.0 is shaping up to be a somewhat sizeable set of changes:
createAsyncThunk
andcreateEntityAdapter
redux-immutable-state-invariant
overredux-devtools-extension
package to see if we can improve shakeability? (or maybe things can get improved upstream)Also, we should totally try to use https://github.com/mweststrate/import-size to help improve our shaking and bundle size.
Sketch of tasks to do:
redux-immutable-state-invariant
redux-devtools-extension
createAsyncThunk
andcreateEntityAdapter
createAsyncThunk
error handling finalized and documentedcreateAsyncThunk
: data fetching in general, standard Redux patterns, how this simplifiescreateEntityAdapter
: normalization in general, a couple recipes for how you could do normalizing yourself and then use these methods to process (like callingnormalizr
in an action creator, and having a slice check foraction.payload.entities.users
and process accordingly)rtk@^1.3.0
Ongoing v1.3.0 integration work is in this PR:
v1.3.0 integration
The text was updated successfully, but these errors were encountered: