Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Generate export query.client functions

オープン
#121 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react, typescript

調査の方向性

Start with the generated query.client output and the existing useHook generation path; the issue names no repository files or tests. Compare the generated API with the React Router loader examples using queryClient.fetchQuery. Done means code generation exposes query keys and query functions for direct loader use without hooks.

索引モデルが issue の本文から書いたものです。

説明

Hi, i try to find a way using the generated query.client types and functions directly without any useHook implementation, so i can use the react-router v6 way of loading data before rendering any component.

there for it is needed to write the router like mentioned in the example as it will handle the data loading in "loaders" before react lifecycle is used. (cannot use useHooks and needs to use the queryclient directly)
https://reactrouter.com/en/main/guides/data-libs#loading-data

import { queryClient } from "./query-client";

export const loader = ({ params }) => {
  return queryClient.fetchQuery(queryKey, queryFn, {
    staleTime: 10000,
  });
};

or more specific example of a loader:

export const loader =
  (queryClient) =>
  async ({ request }) => {
    const url = new URL(request.url);
    const q = url.searchParams.get("q");
    if (!queryClient.getQueryData(contactListQuery(q).queryKey)) {
      await queryClient.fetchQuery(contactListQuery(q));
    }
    return { q };
  };

Is there any way getting the queries with queryKey and queryFn from the codegen?
thx in advance

主要言語
TypeScript
スター
635
フォーク
82
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fabien0102/openapi-codegen のほかの issue

fabien0102/openapi-codegen の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。