fix?: remove useless $state.snapshot

This commit is contained in:
Xylight committed 2025-09-22 21:06:16 -07:00
1 parent 177ded3923
commit 15581e7b07
12 files changed
+29 -23

No files matched your search

@@ -20,12 +20,14 @@
import { SvelteURL } from 'svelte/reactivity' import { SvelteURL } from 'svelte/reactivity'
import Subscribe from '../../../../routes/communities/Subscribe.svelte' import Subscribe from '../../../../routes/communities/Subscribe.svelte'
import CommunityCard from './CommunityCard.svelte' import CommunityCard from './CommunityCard.svelte'
import type { Snippet } from 'svelte'
interface Props { interface Props {
community: CommunityView community: CommunityView
view?: 'cozy' | 'compact' view?: 'cozy' | 'compact'
showCounts?: boolean showCounts?: boolean
resolveObject?: boolean resolveObject?: boolean
children?: Snippet
} }
let { let {
@@ -33,6 +35,7 @@
view = 'compact', view = 'compact',
showCounts = true, showCounts = true,
resolveObject, resolveObject,
children,
}: Props = $props() }: Props = $props()
</script> </script>
@@ -52,6 +55,7 @@
: ''}" : ''}"
orientation={view == 'cozy' ? 'vertical' : 'horizontal'} orientation={view == 'cozy' ? 'vertical' : 'horizontal'}
> >
{#if !children}
{#if community.community.deleted} {#if community.community.deleted}
<Icon <Icon
src={Trash} src={Trash}
@@ -124,7 +128,10 @@
: 'NotSubscribed' : 'NotSubscribed'
community.subscribed = newSubscribed community.subscribed = newSubscribed
addSubscription(community.community, newSubscribed == 'Subscribed') addSubscription(
community.community,
newSubscribed == 'Subscribed',
)
} }
}} }}
size="custom" size="custom"
@@ -152,4 +159,7 @@
</Button> </Button>
{/snippet} {/snippet}
</Subscribe> </Subscribe>
{:else}
{@render children?.()}
{/if}
</CommonItem> </CommonItem>
@@ -35,7 +35,6 @@
if (header) { if (header) {
type = 'tablecell' type = 'tablecell'
console.log(type)
} }
</script> </script>
@@ -97,7 +96,6 @@
{/each} {/each}
</TBody> </TBody>
{/if} {/if}
{console.log($state.snapshot(token))}
{/if} {/if}
{/each} {/each}
</Renderer> </Renderer>
@@ -32,8 +32,8 @@
rounding="xl" rounding="xl"
{...rest} {...rest}
{href} {href}
weight="none"
class={[ class={[
'font-normal block',
'hover:text-slate-900 hover:dark:text-zinc-50', 'hover:text-slate-900 hover:dark:text-zinc-50',
selected selected
? 'text-primary-900 dark:text-primary-100' ? 'text-primary-900 dark:text-primary-100'
-5
View File
@@ -97,11 +97,6 @@ const config: Config = {
key: '', key: '',
loader: async () => (await import('./zh-Hant.json')).default, loader: async () => (await import('./zh-Hant.json')).default,
}, },
{
locale: 'tok',
key: '',
loader: async () => (await import('./tok.json')).default,
},
], ],
fallbackLocale: 'en', fallbackLocale: 'en',
} }
+3 -2
View File
@@ -32,8 +32,9 @@ export class Feed<Params, Response> {
this.#lastParams && this.#lastParams &&
params && params &&
!recursiveEqual<Params>(params, this.#lastParams) !recursiveEqual<Params>(params, this.#lastParams)
) ) {
this.#data = undefined this.#data = undefined
}
this.#lastParams = params this.#lastParams = params
if (this.#data == null) this.#data = await this.#fetch(params) if (this.#data == null) this.#data = await this.#fetch(params)
@@ -56,7 +57,7 @@ export interface FeedTypes {
{ {
posts: PostView[] posts: PostView[]
next_page?: string next_page?: string
params: GetPostss & { page_cursor: string } params: GetPosts & { page_cursor: string }
client: { client: {
itemHeights?: (number | null)[] itemHeights?: (number | null)[]
lastSeen?: number lastSeen?: number
+9 -1
View File
@@ -52,6 +52,12 @@
} }
type ButtonRoundness = keyof typeof buttonRounding type ButtonRoundness = keyof typeof buttonRounding
const buttonWeight = {
md: 'font-medium',
none: '',
}
type ButtonWeight = keyof typeof buttonWeight
interface Props interface Props
extends Omit<HTMLButtonAttributes | HTMLAnchorAttributes, 'prefix'> { extends Omit<HTMLButtonAttributes | HTMLAnchorAttributes, 'prefix'> {
loading?: boolean loading?: boolean
@@ -70,6 +76,7 @@
suffix?: Snippet suffix?: Snippet
onclick?: HTMLButtonAttributes['onclick'] onclick?: HTMLButtonAttributes['onclick']
icon?: IconSource icon?: IconSource
weight?: ButtonWeight
} }
export type { Props as ButtonProps } export type { Props as ButtonProps }
@@ -103,6 +110,7 @@
children, children,
suffix, suffix,
icon, icon,
weight = 'md',
...rest ...rest
}: Props = $props() }: Props = $props()
</script> </script>
@@ -120,6 +128,7 @@
buttonShadow[shadow], buttonShadow[shadow],
buttonColor[color], buttonColor[color],
buttonAlignment[alignment], buttonAlignment[alignment],
buttonWeight[weight],
(disabled || loading) && 'btn-disabled', (disabled || loading) && 'btn-disabled',
alignment == 'center' alignment == 'center'
? 'origin-center' ? 'origin-center'
@@ -163,7 +172,6 @@
align-items: center; align-items: center;
font-size: var(--text-sm); font-size: var(--text-sm);
gap: calc(var(--spacing) * 1.5); gap: calc(var(--spacing) * 1.5);
font-weight: var(--font-weight-medium);
transition: 75ms linear; transition: 75ms linear;
+1 -5
View File
@@ -43,11 +43,7 @@
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import type { Attachment } from 'svelte/attachments' import type { Attachment } from 'svelte/attachments'
import type { ClassValue, HTMLSelectAttributes } from 'svelte/elements' import type { ClassValue, HTMLSelectAttributes } from 'svelte/elements'
import { import { buttonSize } from '../../button/Button.svelte'
buttonColor,
buttonShadow,
buttonSize,
} from '../../button/Button.svelte'
import Menu from '../../popover/Menu.svelte' import Menu from '../../popover/Menu.svelte'
import MenuButton from '../../popover/MenuButton.svelte' import MenuButton from '../../popover/MenuButton.svelte'
import Label from '../Label.svelte' import Label from '../Label.svelte'
+1 -1
View File
@@ -47,7 +47,7 @@
<Header pageHeader class="lg:flex-row justify-between flex-col"> <Header pageHeader class="lg:flex-row justify-between flex-col">
{$t('routes.inbox.title')} {$t('routes.inbox.title')}
<div class="flex gap-2 tracking-normal"> <div class="flex gap-2 tracking-normal items-center">
<Button <Button
onclick={() => goto(page.url, { invalidateAll: true })} onclick={() => goto(page.url, { invalidateAll: true })}
size="custom" size="custom"
+1 -1
View File
@@ -158,7 +158,7 @@
else data.client = { name: 'piefed', baseUrl: '/api/alpha' } else data.client = { name: 'piefed', baseUrl: '/api/alpha' }
} }
} }
class="border-0 rounded-none! border-l" class="border-y-0! border-r-0! rounded-none! border-l"
> >
<Option value="lemmyv3">Lemmy</Option> <Option value="lemmyv3">Lemmy</Option>
<Option value="piefedvalpha">Piefed</Option> <Option value="piefedvalpha">Piefed</Option>
+1 -1
View File
@@ -94,7 +94,7 @@
else form.client = { name: 'piefed', baseUrl: '/api/alpha' } else form.client = { name: 'piefed', baseUrl: '/api/alpha' }
} }
} }
class="border-0 rounded-none! border-l" class="border-y-0! border-r-0! rounded-none! border-l"
> >
<Option value="lemmyv3">Lemmy</Option> <Option value="lemmyv3">Lemmy</Option>
<Option value="piefedvalpha">Piefed</Option> <Option value="piefedvalpha">Piefed</Option>
+1 -1
View File
@@ -37,7 +37,7 @@
</script> </script>
<li <li
class="flex flex-col w-full justify-between gap-2 max-w-full setting @container/setting" class="flex flex-col w-full justify-between gap-x-2 max-w-full setting @container/setting"
> >
{#if Object.values(supportedPlatforms).some((v) => v == false) || beta} {#if Object.values(supportedPlatforms).some((v) => v == false) || beta}
<div class="flex items-center gap-2 flex-wrap"> <div class="flex items-center gap-2 flex-wrap">
-2
View File
@@ -62,8 +62,6 @@
['ru', { name: 'Русский' }], ['ru', { name: 'Русский' }],
['zh-Hans', { name: '简体中文' }], ['zh-Hans', { name: '简体中文' }],
['zh-Hant', { name: '繁體中文' }], ['zh-Hant', { name: '繁體中文' }],
['placeholder', { name: 'Unofficial' }],
['tok', { name: 'toki pona' }],
]) ])
</script> </script>