Skip to content
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

RTK 1.8 and 1.9 planning #2003

Closed
markerikson opened this issue Feb 5, 2022 · 19 comments
Closed

RTK 1.8 and 1.9 planning #2003

markerikson opened this issue Feb 5, 2022 · 19 comments
Milestone

Comments

@markerikson
Copy link
Collaborator

markerikson commented Feb 5, 2022

This was originally "1.8 planning", but 1.8 ended up just having the listener middleware. So, keeping the issue around for both.

1.8:

  • TS fixes for configureStore and getDefaultMiddleware
  • Merge in the listener middleware

Initial notional items for 1.9:

  • Drop support for TS < 4.1
  • Actual string literal types for createSlice

What else would we want to get in?

Existing milestone: https://github.com/reduxjs/redux-toolkit/milestone/7

Looking through the issues, other candidates:

For the record, I think this probably ought to be the last feature release before we look at doing RTK 2.0 and dropping IE11 compat ( ref: #958 )

@markerikson markerikson added this to the 1.8 milestone Feb 5, 2022
@phryneas
Copy link
Member

phryneas commented Feb 5, 2022

maybe a cAT.pinTypes/typeFactory thing?

@markerikson
Copy link
Collaborator Author

Unrelated but as a note for later: we should link the RTKQ "Essentials" tutorial pages from the RTKQ "Overview" page:

https://www.reddit.com/r/webdev/comments/sc6eoc/redux_toolkit_query_is_no_one_using_it/

@lindapaiste
Copy link
Contributor

Another docs suggestion (possibly for me to implement): add more info/examples about dealing with errors. In particular, explaining the difference between a fetch error and serialized JavaScript error. https://stackoverflow.com/questions/70899492/redux-toolkit-do-not-send-request-when-query-param-is-invalid/71002555?noredirect=1#comment125554343_71002555

@phryneas
Copy link
Member

@lindapaiste that would be a very welcome contribution!

@markerikson markerikson pinned this issue Feb 20, 2022
@markerikson markerikson changed the title RTK 1.8 planning RTK 1.8 and 1.9 planning Feb 27, 2022
@markerikson
Copy link
Collaborator Author

Throwing this here for lack of anywhere better:

https://www.reddit.com/r/reactjs/comments/q6lit4/thoughts_about_redux_reactquery_together/i0s3f27/

One thing i found that it needs extra config is SSR, if you are planning on doing SSR with something like Next for example, then you need to setup next-redux-wrapper and split your state, and combining reducers with the apiSlice while also supporting a global HYDRATE action to sync up server state with client state was a bit of a pain, we had to set a reducer case for HYDRATE for each slice, which can get big.

RTK Query looks promising but SSR is certainly a bit more painful compared to the "initialData" approach of react-query, one thing i do like is that you can still use endpoints defined within your apiSlice on the server instead of custom fetch functions.

Also a quick note about that, if you are working with a custom api fetch library that handles all your endpoint calls, its a bit hard to integrate that with query builders in RTK Query, RTK Query seems like a great option if you are using axios or fetch to build your data fetching side of the app from the ground. If you have something custom built already around some fetching library to handle your endpoint calls, then you will probably need to work some sort of integration between RTK Query and your library, react-query is a bit more detached from what you end up using as a fetcher.

@phryneas
Copy link
Member

We should also deprecate the object notation of extraReducers and createReducer so we can remove it in 2.0.

I did some experiments - while removing is not a problem, deprecating the extraReducers object notation seems impossible. It would require adding a second overload to createSlice and that breaks half the inference (seems to be a TS quirk). So I would suggest deprecating it with a runtime warning in dev instead.

@markerikson
Copy link
Collaborator Author

If @FaberVitale can pull off the Suspense support in #2245 , that would presumably be 1.9 as well.

@FaberVitale
Copy link
Contributor

FaberVitale commented Apr 24, 2022

If @FaberVitale can pull off the Suspense support in #2245 , that would presumably be 1.9 as well.

We need to upgrade react, react-redux, react-dom & @types/react to react 18 versions:

"react": "npm:17.0.2",

Are there features in the codebase that need useSyncExternalStore?

IIRC there was an issue with ApiProvider:

setupListeners(store.dispatch, props.setupListeners)

@markerikson
Copy link
Collaborator Author

Hmm. That is going to make versioning interesting :)

Given that the rest of RTKQ's features work with any version of React that has hooks... maybe we accept a React peer range of 16.8+, but have a runtime dev check in the suspense functionality that throws an error if it isn't a high enough React version?

Also we may need to update all of our examples and tests to work under React 18 as well.

And yeah, that line in ApiProvider should really be in an effect

@phryneas
Copy link
Member

I opened a PR for that ApiProvider bug.

@AlexeiDarmin
Copy link

@markerikson @phryneas I've made an additive feature request in #2355 and if 1.8 and 1.9 are possibly going to be the last releases before 2.0 then I'd like to ping y'all to get some priority feedback on it.

I don't know how big of an effort it would be, but if it's a feature that you'd support adding to RTK Query - I'm willing to take a stab at implementing it.

@talatkuyuk
Copy link

talatkuyuk commented May 30, 2022

I have opened a discussion #2361 (comment)

The requested feature : giving an option (optional) in such a way as to skip the automated-invalidation for the last-focused query (only) while setting automated-invalidation in the mutation definition.

toggleFieldOfUser: builder.mutation<boolean, string>({
 query: (id) => ({
    url: `/users/${id}`,
    method: "PUT",
}),
invalidatesTags: cacher.cacheByIdArg("User"),  // <-----------------------  this will remain !
skipAutomatedInvalidationForLastFocusedQuery: true;   // <---------------  additional option (optional)
transformResponse: (result: { success: true }) => result.success,
async onQueryStarted(arg, { dispatch, queryFulfilled, getState }) {
   // manual cache update implementation.  <--- just for the last-focused query, we will deal with ourself
}

@FaberVitale
Copy link
Contributor

If @FaberVitale can pull off the Suspense support in #2245 , that would presumably be 1.9 as well.

We need to upgrade react, react-redux, react-dom & @types/react to react 18 versions:

"react": "npm:17.0.2",

The React 18 upgrade is live here: #2409

#2409 is partially for maintenance but it also required for #2245

@FaberVitale
Copy link
Contributor

Created PR #2420

Closes #2395 Pass abort reason of thunk action to AbortController

@markerikson
Copy link
Collaborator Author

Pasting notes from today's triage call:

Also, not 1.9 related, but:

  • Have some kind of Suspense Cache usage discussion with the React and React Query teams?

@markerikson
Copy link
Collaborator Author

Status notes from Lenz:

@markerikson
Copy link
Collaborator Author

Afraid I didn't do anything on this for about a month - been playing lots of golf, and work's been busy. But, golf season is coming to an end, and I want to pick this up and push it through soon.

I've got tomorrow free and Monday off, and I intend to focus on RTK 1.9 work.

@markerikson
Copy link
Collaborator Author

markerikson commented Oct 15, 2022

Working to collect a list of all the actual PRs that have gone into the 1.9 branch so I can figure out what needs to be documented and how to organize 1.9 release notes, and there's a lot :)

Up to date through #2768 .

The major outstanding code item is #2477 and nailing down an alternative API for getting operation promises. Beyond that we also need updated docs, and the release notes will need to provide instructions on running the codemods. (Probably should put the object reducer deprecation as the very first item in the release notes...)

RTK Query Features

RTKQ Minor Changes

TS Types and Tweaks

Other

@markerikson
Copy link
Collaborator Author

@markerikson markerikson unpinned this issue Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants