File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
hooks/use-merged-infinite-queries Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,11 @@ import {
2525 * @param queries - Array of react-query Infinite Query configurations.
2626 * @param pageSize - Number of items to add to the result array when requesting new data.
2727 * @param flattenResponse - A function that takes the expected query response and flattens it into an array of items
28- * @param compare - A comparison function used to sort and merge results.
29- * The function should accept two arguments and return:
30- * - A number > 0 if the second argument comes first .
31- * - A number <= 0 if the first argument comes first .
32- * - **Note:** The comparison logic must match the sorting logic used in the queries to maintain consistency.
28+ * @param compare - A comparison function used to determine the order of items. It should take two items and return:
29+ * - A positive number (> 0) if the second item should come before the first.
30+ * - Zero or a negative number (<= 0) if the first item should come before the second .
31+ * - This logic must match the sorting logic used in the queries to ensure consistency .
32+ * - For more details, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#comparefn
3333 *
3434 * @returns A tuple [mergedQueryResults, queryResults]:
3535 * - `mergedQueryResults`: The merged and sorted results from all queries.
Original file line number Diff line number Diff line change 77 *
88 * @param sortedArrays - An array of sorted arrays to pick items from and merge.
99 * @param itemsCount - The number of items to pick from the sorted arrays.
10- * @param compareFunc - A comparison function used to determine the order of items.
11- * - If the function returns a number > 0, the first argument is considered the higher-priority candidate.
12- * - If the function returns a number <= 0, the second argument is considered the higher-priority candidate.
13- * **Note:** The comparison logic must align with the sorting logic of the input arrays to maintain consistency.
10+ * @param compareFunc - A comparison function used to determine the order of items. It should take two items and return:
11+ * - A positive number (> 0) if the second item should come before the first.
12+ * - Zero or a negative number (<= 0) if the first item should come before the second.
13+ * - This logic must match the sorting logic of the input arrays to ensure consistency.
14+ * - For more details, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#comparefn
1415 *
1516 * @returns An object containing:
1617 * - `pointers`: An array of the last picked index from each input array.
You can’t perform that action at this time.
0 commit comments