impr: use svelte/reactivity classes for URL, Map, Set

This commit is contained in:
James Xylight committed 2025-08-01 14:18:59 -07:00
1 parent 4680c251d2
commit d1bad1b64e
8 files changed
+21 -38

No files matched your search

+4 -3
View File
@@ -12,6 +12,7 @@
import { Button } from 'mono-svelte'
import { ArrowPath, Check, Icon, Inbox } from 'svelte-hero-icons'
import InboxItem from './InboxItem.svelte'
import { SvelteURLSearchParams } from 'svelte/reactivity'
let { data } = $props()
@@ -42,11 +43,11 @@
currentSearchParams: URLSearchParams,
newParamString: string,
) {
// Create a new URLSearchParams object from the current search params
const updatedParams = new URLSearchParams(currentSearchParams)
// Create a new SvelteURLSearchParams object from the current search params
const updatedParams = new SvelteURLSearchParams(currentSearchParams)
// Parse the new parameter string
const newParam = new URLSearchParams(newParamString)
const newParam = new SvelteURLSearchParams(newParamString)
// Get the key and value of the new parameter
const [key, value]: [string, string] = newParam.entries().next().value!
+2 -1
View File
@@ -16,6 +16,7 @@
import { Button, Modal } from 'mono-svelte'
import { ChatBubbleOvalLeftEllipsis, Icon, Inbox } from 'svelte-hero-icons'
import { expoOut } from 'svelte/easing'
import { SvelteSet } from 'svelte/reactivity'
import { fly } from 'svelte/transition'
interface ConversationPreview {
@@ -34,7 +35,7 @@
}
function filterDuplicates<T, K>(array: T[], predicate: (item: T) => K): T[] {
const seen = new Set()
const seen = new SvelteSet()
return array.filter(element => {
const value = predicate(element)
if (seen.has(value)) {