fix: change keying of virtual feeds
This commit is contained in:
1 parent
4ff574f6e4
commit
0c0509d436
4 files changed
+25
-41
No files matched your search
@@ -30,6 +30,7 @@
|
||||
"svelte-hero-icons": "^5.2.0",
|
||||
"svelte-infinite-scroll": "^2.0.1",
|
||||
"svelte-markdown": "^0.4.1",
|
||||
"svelte-virtual-scroll-list": "^1.3.0",
|
||||
"sveltekit-i18n": "^2.4.2",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"tslib": "^2.4.1",
|
||||
|
||||
@@ -36,9 +36,8 @@
|
||||
export let hideCommunity = false
|
||||
export let view = $userSettings.view
|
||||
|
||||
$: type = mediaType(post.post.url, view)
|
||||
|
||||
$: tags = parseTags(post.post.name)
|
||||
$: type = mediaType(post.post.url, view)
|
||||
$: rule = getTagRule(tags.tags)
|
||||
|
||||
$: hideTitle =
|
||||
@@ -141,7 +140,7 @@
|
||||
>
|
||||
{#if rule != 'hide'}
|
||||
<PostMedia
|
||||
bind:post={post.post}
|
||||
post={post.post}
|
||||
blur={rule == 'blur' ? true : undefined}
|
||||
{view}
|
||||
{type}
|
||||
@@ -150,8 +149,8 @@
|
||||
</div>
|
||||
{#if view == 'list' || view == 'compact'}
|
||||
<PostMediaCompact
|
||||
bind:post={post.post}
|
||||
bind:type
|
||||
post={post.post}
|
||||
{type}
|
||||
class="{$userSettings.leftAlign
|
||||
? 'mr-3'
|
||||
: 'ml-3'} flex-shrink no-list-margin"
|
||||
@@ -171,7 +170,7 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if actions}
|
||||
<PostActions on:hide bind:post style="grid-area: actions;" {view} />
|
||||
<PostActions on:hide {post} style="grid-area: actions;" {view} />
|
||||
{:else if view == 'compact'}
|
||||
<div class="flex flex-row items-center gap-2 text-sm">
|
||||
<Badge>
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
let extracted: Tag[] = []
|
||||
|
||||
const newTitle = title.replace(
|
||||
/^(\[.[^\]]+\])|(\[.[^\]]+\])$/g,
|
||||
(match, content) => {
|
||||
const newTitle = title
|
||||
.toString()
|
||||
.replace(/^(\[.[^\]]+\])|(\[.[^\]]+\])$/g, (match, content) => {
|
||||
const contents = match.split(',').map((part: string) => part.trim())
|
||||
|
||||
contents
|
||||
@@ -33,8 +33,7 @@
|
||||
)
|
||||
})
|
||||
return ''
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
return {
|
||||
tags: extracted,
|
||||
@@ -98,22 +97,6 @@
|
||||
|
||||
export let tags: Tag[] = []
|
||||
|
||||
let displayTitle = title
|
||||
|
||||
const update = () => {
|
||||
if (tags.length == 0) {
|
||||
const result = parseTags(title)
|
||||
tags = result.tags
|
||||
displayTitle = result.title
|
||||
}
|
||||
}
|
||||
|
||||
$: {
|
||||
if (title) {
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
let popoverOpen = false
|
||||
</script>
|
||||
|
||||
@@ -306,7 +289,7 @@
|
||||
data-sveltekit-preload-data="tap"
|
||||
>
|
||||
<Markdown
|
||||
source={displayTitle}
|
||||
source={title}
|
||||
inline
|
||||
noStyle
|
||||
class={view == 'compact' ? '' : 'leading-[1.3]'}
|
||||
|
||||
@@ -217,16 +217,17 @@
|
||||
class="divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
id="feed"
|
||||
>
|
||||
{#each items as row, index (row.index)}
|
||||
<li
|
||||
bind:this={virtualItemEls[index]}
|
||||
data-index={row.index}
|
||||
style={row.index < 7 ? `--anim-delay: ${index * 100}ms` : ''}
|
||||
class="relative post-container {row.index < 7
|
||||
? 'pop-in opacity-0'
|
||||
: ''}"
|
||||
>
|
||||
{#if posts[row.index]}
|
||||
{#each items as row, index (posts[row.index]?.post.id)}
|
||||
{#if posts[row.index]}
|
||||
{@const post = posts?.[row.index]}
|
||||
<li
|
||||
bind:this={virtualItemEls[index]}
|
||||
data-index={row.index}
|
||||
style={row.index < 7 ? `--anim-delay: ${index * 100}ms` : ''}
|
||||
class="relative post-container {row.index < 7
|
||||
? 'pop-in opacity-0'
|
||||
: ''}"
|
||||
>
|
||||
<Post
|
||||
hideCommunity={community}
|
||||
view={(posts[row.index]?.post.featured_community ||
|
||||
@@ -234,14 +235,14 @@
|
||||
$userSettings.posts.compactFeatured
|
||||
? 'compact'
|
||||
: $userSettings.view}
|
||||
post={posts?.[row.index]}
|
||||
{post}
|
||||
class="transition-all duration-250"
|
||||
on:hide={() => {
|
||||
posts = posts.toSpliced(row.index, 1)
|
||||
}}
|
||||
></Post>
|
||||
{/if}
|
||||
</li>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user