Revert "perf: improve efficiency and performance"
This commit is contained in:
1 parent
7e188f218a
commit
4177b42fc2
32 files changed
+470
-248
No files matched your search
@@ -50,6 +50,7 @@
|
||||
let hasMore = $state(true)
|
||||
|
||||
async function loadMore() {
|
||||
console.log(hasMore, loading)
|
||||
if (!hasMore || loading) return
|
||||
|
||||
try {
|
||||
@@ -182,10 +183,10 @@
|
||||
{#snippet item(row)}
|
||||
<li
|
||||
data-index={row}
|
||||
style={row < 9 ? `--anim-delay: ${row * 50}ms` : ''}
|
||||
style={row < 7 ? `--anim-delay: ${row * 50}ms` : ''}
|
||||
class={[
|
||||
'relative post-container px-3 sm:px-6',
|
||||
row < 9 && 'pop-in opacity-0',
|
||||
row < 7 && 'pop-in opacity-0',
|
||||
]}
|
||||
>
|
||||
<Post
|
||||
@@ -218,7 +219,12 @@
|
||||
<Icon src={ExclamationTriangle} size="24" solid></Icon>
|
||||
</div>
|
||||
<pre class="py-0.5">{error}</pre>
|
||||
<Button color="primary" {loading} onclick={loadMore}>
|
||||
<Button
|
||||
color="primary"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
onclick={() => loadMore()}
|
||||
>
|
||||
{$t('message.retry')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -250,7 +256,14 @@
|
||||
</EndPlaceholder>
|
||||
</div>
|
||||
{/if}
|
||||
<InfiniteScroll window threshold={600} on:loadMore={loadMore} />
|
||||
<InfiniteScroll
|
||||
window
|
||||
threshold={600}
|
||||
on:loadMore={() => {
|
||||
console.log('loadMore triggered')
|
||||
loadMore()
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</ul>
|
||||
@@ -269,6 +282,6 @@
|
||||
|
||||
.pop-in {
|
||||
animation: popIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards
|
||||
var(--anim-delay, 0ms);
|
||||
var(--anim-delay);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user