batch client requests?

in my root app layout i need to grab a few pieces of info. right now i throw it in a promise.all and it fire 3 reqs afaik. it seems like i could pretty easily wrap in an rpc and grab all of these in one go, and then respond with 1 request to the client. is there native way to group these together?

e.g. currently
// tanstack beforeLoad()
    const [authResult, listResult, activeResult] = await Promise.all([
      // ignore syntax, wrapper on auth.<whatever>
      withAuthClient((c) => c.getSession()), 
      withAuthClient((c) => c.organization.list()),
      withAuthClient((c) => c.organization.getFullOrganization()),
    ]);

// could become something like...?
    const [auth, list, active] = await auth.getAll((client) => [
      client.getSession,
      client.organization.list,
      client.organization.getFullOrganization,
    ]);
Was this page helpful?