reactjs / reactjs/react.dev

Translation feature in concurrent mode's example CodeSandbox might not work.

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

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

主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

https://reactjs.org/docs/concurrent-mode-patterns.html#splitting-high-and-low-priority-state
In above section's example CodeSandbox, yandex-translate is used for translation feature.

But, translation doesn't work when I open the CodeSandbox.
↓ The translation result should appear under the input.
スクリーンショット 2021-01-02 1 55 41

And I got a following message from the response of translate().

// fakeApi.js
export function fetchTranslation(text) {
  const promise = new Promise(
    (resolve, reject) => {
      translate(
        text,
        {
          to: "fr"
        },
        (err, res) => {
          if (err) {
            reject(err);
          } else {
            console.log(res) // <- Added this line
            resolve(res.text);
          }
        }
      );
    }
  );
  return wrapPromise(promise);
}
code: 404
message: "Maximum daily translated text volume exceeded"

This is not an example code's bug, but it can be confusing for beginners. (Actually, I suspected a bug in the React part of the code at first.)
Can we avoid this problem? For example, use other translation feature, use another plan(?) of yandex-translate.

Thanks.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

Concurrent Mode パターンのドキュメントと、そこからリンクされている CodeSandbox を開き、続いて例の fakeApi.js にある翻訳経路を調べます。yandex-translate リクエストが報告された quota エラーを返す理由を確認し、例を引き続き利用可能にするサポートされた方法を決定します。入力の下に翻訳結果が表示され、利用できない翻訳 quota に依存しない状態になれば完了です。

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

評価

技術スタック
javascript, react
領域
documentation
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

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

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