f / f/react-wait

startWaiting with useEffect hook overrides waiters array

オープン
#13 コメント 5 件 リアクション 5 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
306
フォーク
28
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi there!
Thank you for this awesome library.
I experienced a kind of weird behavior while working with this library.

**Description**
if I use method startWaiting in useEffect hook like

```
useEffect(() => {
startWaiting('first');
startWaiting('second');
}, []);
```
**Result**
waiters array contains only 'second' waiter, so waiters array is overwritten.

the same issue would be in the example below:

component1:

```
const Component1 = () => {

useEffect(() => {
const fetchData = async () => {
startWaiting('first');
const response = await apiCall();
endWaiting('first');
}
fetchData();
}, []);

return (/*react markup and Wait component inside*/);
```

component2:

```
const Component2 = () => {

useEffect(() => {
const fetchData = async () => {
startWaiting('second');
const response = await anotherApiCall();
endWaiting('second');
}
fetchData();
}, []);

return (/*react markup and Wait component inside*/);
```

component3:

```
const Component3 = () =>
(


);
```

in this case, every time I am trying to receive waiters array it will contain only 'second'.

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

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

1つの useEffect 内で 2 つの startWaiting 呼び出しを使用して問題を再現し、結果の waiters 配列を、Component1 と Component2 を分けた例と比較します。リポジトリ内の startWaiting と waiter の状態のエントリーポイントを調査します。'first' と 'second' の両方の waiter が、それぞれに対応する endWaiting 呼び出しまで利用可能なままであれば完了です。

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

評価

技術スタック
javascript, react
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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