Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Browsing all 1539 articles
Browse latest View live

hooks.server and page.server authentication infinite loop

I am facing a problem with an infinite loop in my authentication process. I have a separate login system from my main page, which redirects to the /auth/callback path sending a token via URL parameters...

View Article


how to work with data models in svelte 5 (example: Product, Product[])

in svelte 4, I used the following approach:<script lang="ts"> class Product { id: number = 0; name: string = ""; description: string = ""; } let products: Product[]=[]; let productForAdd = new...

View Article


How to properly store state in child components? [closed]

https://svelte.dev/playground/2db69e5386f640698e015a1de450ad10?version=5.16.0The app has a few filters: All, Active, and Inactive. I need it so that when switching filters, if Plugin A's settings were...

View Article

$state object could not be cloned

After I switched to Svelte 5 syntax I am getting this error when I pass a reactive variable to a functionlet details = $state({ user: '', pass: ''})// ...await login(details) // <- errorbut works if...

View Article

Effects no longer work with reactive objects when using runes

In Svelte 4, the effect below would fire every time user or pass props from it changedlet data = { user, pass,};$: data && clearErrors()In Svelte 5 the equivalent code with runes would be:let...

View Article


How can I pass parameters to on:click in Svelte?

Binding a function to a button is easy and straightforward:<button on:click={handleClick}> Clicks are handled by the handleClick function!</button>But I don't see a way to pass parameters...

View Article

Svelte warning - State referenced in its own scope will never update

I get this warning from SvelteState referenced in its own scope will never update. Did you mean to reference it inside a closure?but the code seems to work fine. Should I be worried about it?this is...

View Article

Form Enhancement with Superforms and Shadcn Svelte does not work in svelte 5

I've started a new project using svelte kit with svelte 5. I opted for shadcn-svelte and build a simple login form with superforms.<script lang="ts"> import type {PageData} from "./$types";...

View Article


SvelteKit: How to output build as single HTML file with inlined JS and CSS?

Is it possible to build a SvelteKit project to a single output HTML file which inlines all JS and CSS? Could SvelteKit be configured to support this output format or do I need to use an external build...

View Article


How to achieve the nuxt 2 routing structure below in Sveltekit using a single...

I am trying to port a nuxt 2 web app to Sveltekit (version 5 I guess) and have run into this hiccup with respect to urls and routing.Route Structure in Nuxt 2routes.jsI am trying to achieve the...

View Article

D3 network graph

I have created a d3 network graph which is working fine, issue is if there is a connection between (A -> B and B -> A) i want separate links for that. How can i do that?This is what i have done...

View Article

How to reactively pass parameters to sveltekit load function?

export async function load({fetch,session}){ const response = await fetch(`https://atlas.mapmyindia.com/api/places/geocode?address=${curcity}&bias=1&podFilter=city&itemCount=3`, {headers:...

View Article

How to get image metadata into useChat within Svelte?

I am writing a ChatBot using Svelte and am using the useChat function to interface with my backend to talk to an LLM.<script lang="ts"> import ChatList from '$lib/components/ChatList.svelte';...

View Article


Image may be NSFW.
Clik here to view.

Paypal button container sets background to white

I'm using the paypal api and I'm currently implementing the paypal buttons(sandbox mode). When I create them, the container background is set to white and can't change it. I'm currently using svelte...

View Article

Error when evaluating SSR module even when SSR is disabled - svelte-kit

I wanted one of my route in my app not to be server side rendered.The way to do this will be doing export const ssr = false in module script or setting ssr: false in svelte.config.js as mention in...

View Article


Is there a way to debounce a Svelte 5 $derived value?

I tried with:let searchText = $derived(debounce((typedText) => typedText, 2000)(typedText));But searchText is not assigned!Reproduction with $derived: searchText is not assigned.Reproduction with...

View Article

How to import a svelte.ts component from another app where the import is with...

Hi im trying to import a svelte component from another svelte.ts app. This component has a script:button.svelte:<script lang="ts"> import { cn } from "$lib/utils.js"; let { class: className,...

View Article


What is the correct TypeScript type for the `children` property in Svelte 5?

In Svelte 5 it now retrieves children from the the $props() rune. I wasn't able to find any documentation stating how the props reserved children property should be typed and the type is not included...

View Article

How to add a signature to a pdf document in a specific place using forms in...

i tried using jsPdf, signature pad but all i could do is add the signature to a pdf created using forms but i couldn't put the signature in the desired place.i need a solution for thisif I input a PDF...

View Article

API Fetch Request Works on Desktop but Not on Mobile – CORS or HTTPS Issue?

I'm building a Svelte app that fetches random quotes from an API (https://zenquotes.io/api/random). The app works perfectly on desktop browsers but fails to fetch data on mobile devices (both locally...

View Article
Browsing all 1539 articles
Browse latest View live