No error handling available for createInfiniteScroll
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- frontend
調査の方向性
Issue に示されている createInfiniteScroll エントリーポイントから始め、その JSX ドキュメントを返される API および createResource の使用方法と比較してください。loading 状態と error 状態の意図された動作を確認し、続いて公開 API が両方の状態を公開していることと、関連する動作がテストされていることを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
In the JSX Docs it clearly says that we get any errors using pages.error but the current implementation has not property that says error and loading... How am I suppose to get errors back
/**
* Provides an easy way to implement infinite scrolling.
*
* ```ts
* const [pages, loader, { page, setPage, setPages, end, setEnd }] = createInfiniteScroll(fetcher);
* ```
* @param fetcher `(page: number) => Promise<T[]>`
* @return `pages()` is an accessor contains array of contents
* @property `pages.loading` is a boolean indicator for the loading state
* @property `pages.error` contains any error encountered
* @return `infiniteScrollLoader` is a directive used to set the loader element
* @method `page` is an accessor that contains page number
* @method `setPage` allows to manually change the page number
* @method `setPages` allows to manually change the contents of the page
* @method `end` is a boolean indicator for end of the page
* @method `setEnd` allows to manually change the end
*/
export function createInfiniteScroll<T>(fetcher: (page: number) => Promise<T[]>): [
pages: Accessor<T[]>,
loader: (el: Element) => void,
options: {
page: Accessor<number>;
setPage: Setter<number>;
setPages: Setter<T[]>;
end: Accessor<boolean>;
setEnd: Setter<boolean>;
},
] {
const [pages, setPages] = createSignal<T[]>([]);
const [page, setPage] = createSignal(0);
const [end, setEnd] = createSignal(false);
let add: (el: Element) => void = noop;
if (!isServer) {
const io = new IntersectionObserver(e => {
if (e.length > 0 && e[0]!.isIntersecting && !end() && !contents.loading) {
setPage(p => p + 1);
}
});
onCleanup(() => io.disconnect());
add = (el: Element) => {
io.observe(el);
tryOnCleanup(() => io.unobserve(el));
};
}```
const [contents] = createResource(page, fetcher);
createComputed(() => {
const content = contents.latest;
if (!content) return;
batch(() => {
if (content.length === 0) setEnd(true);
setPages(p => [...p, ...content]);
});
});
return [
pages,
add,
{
page: page,
setPage: setPage,
setPages: setPages,
end: end,
setEnd: setEnd,
},
];
}
### Minimal Reproduction Link
https://example.com/
- 主要言語
- TypeScript
- スター
- 1.6k
- フォーク
- 162
- 平均マージ
- 19時間 40分
- マージ済み PR(30日)
- 8
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solidjs-community/solid-primitives のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
solidjs-community/solid-primitives#1059 · コメント 1 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
solidjs-community/solid-primitives#1000 · コメント 3 件 · リアクション 5 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
solidjs-community/solid-primitives の issue をすべて見る
似ている issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Crush オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/cln-application#167 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Quantco/pnpm-licenses#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100