Can't call fetch when a prop changes
I have a component that takes year as a prop and must fetch some data for that year and render based on the data.export let year;onMount(async()=>{ data = await fetchData(year);}){#each data as...
View ArticleCursor jumps to top when clicking toolbar
I have been implementing Quill in my svelte project. But when I press a button on the toolbar, it places to cursor at the beginning of the editor, making it unable to edit text somewhere in the middle...
View ArticleSvelte Flowbite create dropdown in {#each} block and close at select
I tried to create a page to set/change key-value pairs for the item.There is a button to create a new line in the form with two input, one select, and one textfield.I'd like change the select to...
View ArticleGenerate an "infinite" css grid with svelte and intersection observer API
I'm trying to mock up a turn based strategy, civ like game in the browser. I want to have a css grid that can load/unload content as the user scrolls the board/world.My current method is to render a...
View ArticleModify which part of the object will be shown in Svelte
I am new to svelte and want to write a simple multilanguage script.my data:export const content={"intro": "De Intro","introEn": "En Intro",}in my template i am...
View ArticlePath parameters when navigating
I'm using svelte + vite + routify, I have problem with navigation, this is example im using image event on click to navigate<img src={data?.images?.[0]?.src} alt={data?.name} class="rounded-lg"...
View ArticleIs this the only way to get DaisyUI colors based on the theme in Svelte?
I'm using Svelte with DaisyUI and need to retrieve the current theme colors dynamically. I rely on these colors in chroma-js, so it’s crucial to get them correctly. The code below works for me, but it...
View ArticleHow to import material web component to svelte project
I'm new to svelte and having some problem to import material web component to svelte project.First it seems works fine when project first run with imported components (like tabs,buttons... )<script...
View ArticleDisable certain a11y warnings globally in sveltekit
Sveltekit has very strict a11y checks, for instance you can't just add on:click to a div.I can suppress it on a per-line bases, e.g.:<!-- svelte-ignore a11y-click-events-have-key-events...
View Article.htaccess doesn't seem to be redirecting my file requests properly
I have a Svelte Node.js application (compiled with adapter-node) and WordPress installation in the /public_html folder. I've set the WordPress URL to be [domain].com/admin. My code structure looks a...
View ArticleSvelteKit fetching on the server and updating the writable store
I was wondering what is the best way to do data fetching in SvelteKit since I ran into the following problem on my app.I have a writable store like so:import { writable } from "svelte/store";export...
View ArticlePath parameters when navigating in dynamic routes svelte + routify
I'm using svelte + vite + routify, I have problem with navigation, this is example im using image event on click to navigate<img src={data?.images?.[0]?.src} alt={data?.name} class="rounded-lg"...
View ArticleSyntaxError: ambiguous indirect export: default Error when importing my own...
I have written a validation class and want to include it in my VueJS 3 project. Unfortunately I get the following error: SyntaxError: ambiguous indirect export: defaultThis is my code://...
View Article$state run in svelte 5 is narrowing type
I have a filter variable of type "all" | "active" | "completed", which I initialize to 'all'(in fact it's reactive, declared with $state('all') but I can reproduce the issue with a plain variableso...
View ArticleIssue with Dynamic Importing of Svelte Component in JavaScript with Svelte
I'm trying to dynamically import a Svelte component in my project, but I'm encountering a TypeError when including the file extension in the variable that holds the component name.Here is the working...
View ArticleImport Svelte component from a path which is set in string variable
I am trying to import Svelte component from path which is set in string variable.When I import the component using directly, it is working:import("./Component.svelte").then(module => { Component2 =...
View ArticleHow can I disable the "Left side of comma operator is unused and has no side...
I am writing some reactive statements in Svelte, which often look like this:$: someVariable, processStuff();When someVariable changes (or if its contents change, in the case of an object), the function...
View ArticleNo Intellisense working at all in Svelte files
I am working on a project in Svelte and InertiaJS in Visual Studio Code. For a long time, I've been coding without any issue whatsoever. However, recently, all Intellisense has gone away from my Svelte...
View ArticleReactive function in svelte not firing when the value changes?
Entire code sample below.The problem I have is that I know vatSuccess is actually changing successfully. However when I try to do anything with it in a reactive manner when I know it should be true it...
View ArticleHow to use media queries in Svelte?
I'm using svelte-kit and I'm quite new to it. On my +page.svelte file, I got:<script lang="ts"> const { data } = $props();</script>where I'm using data to display a hero image.<div...
View Article