Skip to content

feat: v11 goals & suggestion box #3496

Closed

Description

@KATT

🚀 v11 is available to use and ready for production: https://trpc.io/docs/migrate-from-v10-to-v11

Summary

Plan

Before official alpha

Beta

  • Rename main to 10.x & next -> main

Maybes of things to do

Subtle breaking changes

See https://github.com/trpc/trpc/blob/next/.wip/changes.md

Hey you! Yes, you!

Anything you think we should add that should be fixed?

Activity

  1. added
    😌 QoL
    on Dec 27, 2022
  2. changed the title [-]feat: v11 [/-] [+]feat: v11 goals[/+] on Dec 27, 2022
  3. moved this to Ready to work on - Focus in Roadmap and prioritieson Dec 27, 2022
  4. Nick-Lucas commented on Dec 27, 2022

    @Nick-Lucas
    Contributor

    This might be a bigger discussion and way out of scope here, but I think the React Query API could be cleaner long term if changes are on the table. There are a few painpoints with it

    Take this rough example:

    import { trpc } from '../utils/trpc';
    
    function MyComponent() {
      const utils = trpc.useContext();
      
      const postsQuery = trpc.post.all.useQuery({ pageSize: 100 })
      const mutation = trpc.post.useMutation({
        onSuccess: () => {
          utils.post.invalidate(/* id etc */)
        }
      })
    }

    There are a couple painpoints:

    • trpc.post.useSomeHook is still not lintable by eslint because it doesn't follow the expected patterns of hooks. It may be easier to change the API rather than change the 'rules' which have been pushed since 2019
    • utils comes from useContext, which is a slight naming inconsistency in TRPC's patterns, and collides with the react API. At minimum useContext might be renamed to useUtils
    • We have to navigate utils and trpc separately in order to access different methods on the same procedure. I suppose this is because a procedure called "invalidate" might exist and collide if they were collocated. My experience is it does feel a little unergonomic though.

    Something a bit tidier might look like:

    import { useUtils, useMutation, useQuery } from '../utils/trpc';
    
    function MyComponent() {
      const utils = useUtils();
    
      const postsQuery = useQuery(trpc => trpc.post.all({ pageSize: 100 })) // .all would likely return a config object, so query keys can be calculated, rather than being the trpc call itself
      const mutation = useMutation(trpc => trpc.post.update, {
        onSuccess: () => {
          utils.post.invalidate(/* id etc */)
        }
      })
    }

    Doesn't cover everything, but getting linting working seems like the important piece, and bringing the utils naming in line seems like low-hanging-fruit

  5. lilingxi01 commented on Dec 28, 2022

    @lilingxi01
  6. oljimenez commented on Dec 28, 2022

    @oljimenez
  7. TkDodo commented on Dec 28, 2022

    @TkDodo
    Contributor
  8. kran6a commented on Dec 28, 2022

    @kran6a
  9. KATT commented on Dec 28, 2022

    @KATT
    MemberAuthor

    Thanks, everyone! In order to keep the conversation here tidy, we will hide discussions & things that wouldn't result in breaking changes - feel free to open separate issues on those. If you wanna debate or discuss specific topics here, join Discord. I just set up a channel specifically for v11.

    • @kran6a, your suggestion shouldn't require breaking changes and is somewhat covered by the SOA-example
    • @TkDodo, we would love to try to sync this with v5 of react-query
    • @Nick-Lucas, I love your suggestion and this is something we debated heavily and we considered exactly this design, we might revisit in the future but it's not something we'll do in the next 3-6 months
      • if we do we'll do codemods for people to migrate easily
      • @oljimenez, as a response to your comment: there's nothing with this API proposal that would need to work differently than how tRPC works today.
    • @lilingxi01, your suggestion would not require a breaking change but open an issue separated with a clearer description on what problem it's trying to solve
  10. 51 remaining items

  11. kashipai commented on Aug 7, 2024

    @kashipai

    @bchilcott In my reproduction repo (https://github.com/akashdevcc/zero-stack), I have resolved my issue. The root cause was probably using "commonjs" modules for "trpc" section of my project.

    Because each package needs to be built first and export everything which was required by another package, somehow "trpc's unstable-core-do-not-import" types were not getting resolved. To resolve the issue, I explicitly re-exported those unresolved types from my packages/trpc package and it worked!!

    However, as mentioned in tRPC code comments here, importing from this file should be avoided. So, I may file a new issue as instructed in this file.

    Thanks for this. Helped me solve issues in something I was working with.

  12. Pewtro commented on Aug 27, 2024

    @Pewtro

    Is there an estimated, or a goal, of when you'd want to release 11.0.0 as a stable version and not a *-next version? I can see a few tasks that aren't done in this goals/suggestions issue, but I don't see any associated issues or pull requests to those so I don't know what the progress is for those 😄

  13. tinrab commented on Sep 22, 2024

    @tinrab

    I have one suggestion regarding websockets and the ws package. I like what crossws (and nitro) is doing. It gives you a standard WebSocket API usable with different adapters, for Deno, Bun and others. Because tRPC relies on ws, calls e.g. client.once(...) don't work across different runtimes. applyWSSHandler and getWSConnectionHandler could be changed to use standard WebSocket APIs.

  14. KATT commented on Sep 22, 2024

    @KATT
    MemberAuthor

    cc @tinrab - I like the look of that too, but I won't rewrite our WS adapter anytime soon, feel free to have a stab at it.

  15. barziahmed commented on Jan 21, 2025

    @barziahmed

    @KATT, It seems all goals are accompolished. Is table version getting published soon?

  16. EmilMalanczak commented on Feb 16, 2025

    @EmilMalanczak

    @bchilcott In my reproduction repo (akashdevcc/zero-stack), I have resolved my issue. The root cause was probably using "commonjs" modules for "trpc" section of my project.

    Because each package needs to be built first and export everything which was required by another package, somehow "trpc's unstable-core-do-not-import" types were not getting resolved. To resolve the issue, I explicitly re-exported those unresolved types from my packages/trpc package and it worked!!

    However, as mentioned in tRPC code comments here, importing from this file should be avoided. So, I may file a new issue as instructed in this file.

    Worked for me however I was able to get any clue about it after analyze the build files.
    At first I was getting error Unsafe call of an error type typed value. The problem existed only for react-query package which was even more unintuitive (my client code is 1:1 the same as in the docs)

    Simple reexport export type * from @trpc/server did the job for me 🤷. Hopefully that will help someone

  17. dsmurl commented on Mar 4, 2025

    @dsmurl

    @ax-at I have this same issue in my repo here: https://github.com/dsmurl/an-express-next

    Is there a suggested best path past this? I've been stuck for weeks.

  18. lcswillems commented on Mar 5, 2025

    @lcswillems

    Hey @KATT, what's the reason preventing the release of a v11 stable release? It is said here and there that v11 is stable. So if it is stable, why not publishing a v11 version?

  19. Nick-Lucas commented on Mar 5, 2025

    @Nick-Lucas
    Contributor

    @lcswillems mostly just that we wanted to get out the Tanstack React Query client first and get it stable, we're very close now. But at large V11 is very stable and has been for a while, a lot of folk use it in production so we're as serious about avoiding breaking changes as a full V11 release now.

  20. lcswillems commented on Mar 5, 2025

    @lcswillems

    Thanks @Nick-Lucas for the context! 🙏

  21. moved this from Ready to work on - Focus to ✅ Done in Roadmap and prioritieson Mar 23, 2025
  22. unpinned this issue on Mar 23, 2025
  23. github-actions commented on Mar 25, 2025

    @github-actions
    Contributor

    This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.

  24. locked as resolved and limited conversation to collaborators on Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

RFC😌 QoL

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions