-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for Svelte 5 #24
Comments
I would like to know the same. Whether this project is abandoned or not. Its one of the few that I found to work decently well with dynamic sized data. |
Hello |
I tried just changing the <svelte:options runes={true} />
<script lang="ts">
import { onDestroy, onMount } from "svelte";
const {
resize,
horizontal = false,
uniqueKey,
type = "item",
}: {
resize: (arg0: { id: any; size: number; type: any }) => void;
horizontal: boolean;
uniqueKey: any;
type: string;
} = $props();
let resizeObserver: ResizeObserver | null;
let itemDiv: HTMLElement;
let previousSize: number;
const shapeKey = horizontal ? "offsetWidth" : "offsetHeight";
onMount(() => {
if (typeof ResizeObserver !== "undefined") {
resizeObserver = new ResizeObserver(dispatchSizeChange);
resizeObserver.observe(itemDiv);
}
});
$effect(dispatchSizeChange);
onDestroy(() => {
if (resizeObserver) {
resizeObserver.disconnect();
resizeObserver = null;
}
});
function dispatchSizeChange() {
const size = itemDiv ? itemDiv[shapeKey] : 0;
if (size === previousSize) return;
previousSize = size;
resize({ id: uniqueKey, size, type });
}
</script>
<div bind:this={itemDiv} class="virtual-scroll-item">
<slot />
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Svelte 5 now has a RC, so I'm curious if there are any chances of this being updated to support Svelte 5?
I'm thinking a minimal update would only require updating peer dependencies.
This would at least get rid of the warning when installing packages:
However, to be compatible with Svelte 5 configured to Runes mode project-wide, more involved changes would be required.
Are there any plans/thoughts on this matter?
The text was updated successfully, but these errors were encountered: