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

ESLint for TypeScript and Svelte: no-unused-vars Warning with Reactive Stores

I'm encountering a problem with my ESLint configuration when using Svelte and TypeScript. Despite following various guides, I keep getting no-unused-vars warnings for reactive statements. Here's my...

View Article


How to run SvelteKit & Cloudflare Page locally?

I'm trying to create a new app using SvelteKit & Cloudflare Pages and I'm struggling with running the application locally in a proper manner. Currently, in order to get the app running locally I...

View Article


How to build Svelte into modular Components as ES modules?

I'm working on app that's mostly plain JS. And I need to plug some components made with Svelte.It doesn't have to be WebComponents, just plain JS (even better TS as ES module) would be good enough. The...

View Article

How to avoid redundant API calls in SvelteKit when fetching post data

I'm working on a SvelteKit application where I need to fetch a list of posts data and avoid redundant API calls.Route:all-posts/+page.svelteFetches the list of posts using...

View Article

Unexpected "Internal Error" when accessing my user authorized dashboard after...

I'm encountering an unexpected error in my SvelteKit application when trying to access the /account route as I'm logging in or occasionally on a page refresh.This error doesn't happen every time and...

View Article


Ignore Tailwind CSS dark attribute

I am building a simple web page in Svelte using shadcn-svelte. Some of the components they ship seem to add the dark attribute as a default to my HTML element during building which is something I do...

View Article

How to make this code an helper to be able to use it everywhere in my app?

I'm trying to create an "universal helper" to be used in my Svelte Kit app to be able in a SIMPLE way to persist in the URL the filter conditions of a dashboard or a list so that I can:return to...

View Article

Image may be NSFW.
Clik here to view.

HTML table row not resizing on mobile

I'm having a table with multiple rows and columns on Svelte. It can resize fine on desktop using the devtool, but when I try it on my phone and tablet the rows get very tall.this is the code for the...

View Article


Redirect using server hooks not working in SvelteKit

I am creating an application in sveltekit, trying to protect my routes through the use of hooks or middleware, but when I am logged in and try to enter an unprotected route, I want to redirect to the...

View Article


Official example Svelte modal component is not closing from parent component...

I have added Modal to my Sveltekit Application from official example given at https://svelte.dev/examples/modalMy Modal.svelte is<script> export let showModal; // boolean let dialog; //...

View Article

access current request event cookie in a module other than server load functions

In svelte, I'm trying to create a module that that gives you an Storage api that is the same for ssr and csr. For instance you can't use localStorage in a server-side component, so calling that method...

View Article

Svelte+Prisma Cannot use specific field of the model

I am trying to make CRUD app to learn some basic. To be honest I was wallowing this guide: YouTube.I ended up being stuck at the end trying to make "Edit Article" work. Btw It is working, when I click...

View Article

How do I fetch a post by ID without API and stop calling the API every time I...

StackSvelte@tanstack/svelte-querySetupI have two different pages (HTML omitted):posts/+page.sveltepost/[id]/[title]/+page.svelteI use TanStack Query for storing data from the API. While I reference...

View Article


Snapping to the top when doing Svelte page transitions

I've implemented a fading transition when changing pages in Svelte, and it works great. The only problem is that when you've scrolled down a bit on a page and click another link in the nav, it snaps...

View Article

Resetting a Sveltekit form

I have a form in a modal where I'm using use:enhance to prevent a page reload. If the form submission is successful I flip a boolean (reserveSent) to hide the form and show a thank you message.$:...

View Article


How should I build my store for complex object with methods?

My object is like:const inventory = { maxSlots: 24, content: [ {id: "item_01", quantity: 5, slotId: 0}, {id: "item_02", quantity: 2, slotId: 2}, {id: "item_03", quantity: 1, slotId: 6}, ]};I need...

View Article

How do we do "named slots" in in Svelte 5?

Svelte 5 Slots are ConfusingNow, with Svelte 5 at pre-release, I feel I can express some confusion about slots in Svelte 5. In Svelte 4, slot and names slots where done in the following...

View Article


When to use form actions vs. on:submit?

I am currently learning Svelte and SvelteKit and so far I like it.However one thing that puzzles me a bit is the question when I should use form actions and when should I use a simple on:submit...

View Article

Can't create a sveltekit project

When I run npm create svelte@latest app in my folder I am getting this error.node:internal/errors:490 ErrorCaptureStackTrace(err); ^Error [ERR_MODULE_NOT_FOUND]: Cannot find module...

View Article

Prevent svelte build from including inline script as it violates CSP

I have a svelte + typescript app. I build the app with node-adapter and hosted it with the node+express+ts backend (which also uses helmet). The build produced by Svelte contains inline script, which...

View Article
Browsing all 1539 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>