@casinogate/ui 1.9.8 → 1.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -115,11 +115,6 @@
|
|
|
115
115
|
|
|
116
116
|
currentPage = page;
|
|
117
117
|
hasMore = result.hasMore;
|
|
118
|
-
|
|
119
|
-
// Check if viewport needs more items after render
|
|
120
|
-
requestAnimationFrame(() => {
|
|
121
|
-
checkNeedMoreItems();
|
|
122
|
-
});
|
|
123
118
|
} catch (err) {
|
|
124
119
|
error = err instanceof Error ? err.message : 'Failed to fetch data';
|
|
125
120
|
} finally {
|
|
@@ -127,34 +122,15 @@
|
|
|
127
122
|
}
|
|
128
123
|
};
|
|
129
124
|
|
|
130
|
-
//
|
|
131
|
-
const checkNeedMoreItems = () => {
|
|
132
|
-
if (!viewportRef || isLoading || !hasMore) return;
|
|
133
|
-
|
|
134
|
-
const { scrollHeight, clientHeight } = viewportRef;
|
|
135
|
-
|
|
136
|
-
// If content doesn't fill viewport, load more
|
|
137
|
-
if (scrollHeight <= clientHeight) {
|
|
138
|
-
loadMore();
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// Fetch on first open or check viewport fill
|
|
125
|
+
// Fetch on first open
|
|
143
126
|
watch(
|
|
144
127
|
() => open,
|
|
145
128
|
() => {
|
|
146
129
|
if (!open) return;
|
|
147
130
|
|
|
148
|
-
|
|
149
|
-
if (items.length === 0 && !isLoading && !loadImmediate) {
|
|
150
|
-
fetchData(1);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
131
|
+
if (isLoading || items.length > 0 || loadImmediate) return;
|
|
153
132
|
|
|
154
|
-
|
|
155
|
-
requestAnimationFrame(() => {
|
|
156
|
-
checkNeedMoreItems();
|
|
157
|
-
});
|
|
133
|
+
fetchData(1);
|
|
158
134
|
}
|
|
159
135
|
);
|
|
160
136
|
|