Quantcast
Channel: Active questions tagged svelte - Stack Overflow
↧

What's the proper way of creating a custom element/web component for...

Tried creating a web component/custom element that would wrap a table from tabulatorjs using svelte, but for some reason can't get the table to properly display. I've followed the docs text and it...

View Article


fetch asynchronous data svelte

basic backgroundI am designing an anonymous board using Svelte 4, now I have a route routes\board\[board_url]\ which has +page.server.js and +page.svelte. In +page.server.js, I will get information...

View Article

How to resolve concurrent dependency change?

So let's say I have these variables ($: marks a reactive statement, so when any of the values after = change, the variable is updated):let x = 0;$: y = x;$: z = x + y;function...

View Article

vitest and svelte component's onMount

I'm trying to use Svelte to create a simple reactive component. The component loads data from an api server onMount and updates a reactive value (which updates a html element).I have a simple vitest...

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


Type for Components Passed as Props in Svelte 5

Let's say I have a parent component called SplitView.svelte:<script lang="ts"> import type { Snippet } from 'svelte' type Props = { master: Snippet detail: Snippet } let { master, detail }: Props...

View Article

Playwright test fails because of Mapbox and LineAwesome

I have a Svelte application that interact with Mapbox-gl and Line-Awesome. I'm defining a test suite for that using Playwright. My playwright configuration is:import { defineConfig } from...

View Article

How to update the page and query parameters in SvelteKit?

I have a page with a search field. If accessed with a query parameter (e.g. ?word=cat) the page should load with results present and the search field filled. If a search is done the results and the...

View Article


images paths in the build when they are provided from a JSON

I have a Svelte 5 app (not SvelteKit) where the data, including images paths, is provided from JSON.Images are in src/lib directory, as advised in the official Svelte doc.data.json:[ {"title": "tile...

View Article


Svelte not importing fonts

I store fonts in static/fontsHere is index.css@font-face { font-family: 'SpaceMono Regular'; src: url('fonts/SpaceMono-Regular.tts');}@font-face { font-family: 'SpaceMono Bold'; src:...

View Article

How to migrate to Svelte 5.0.0?

I have been running a pre-release of Svelte 5 as described in the package.json below.How do I migrate from 5.0.0-next.150 to the new Svelte 5.0.0 release?Below is my package.json"devDependencies":...

View Article

Blur Child Input Component from Parent in Svelte 5

I have a custom <MyInput /> component like this:<script lang="ts">//=== MyInput.svelte ===type Props = { input: HTMLInputElement value: string}let { input = $bindable(), value = $bindable()...

View Article

Svelte 5 library for syncing any remote states

I have an existing Svelte 4 app which uses stores.I would like to rewrite it to Svelte 5 and make reusable function or class which synchronizes reactive states (runes) for any app states. $states...

View Article


md class spacebarr cannot be removed

body { font-family: 'DM Sans Variable', sans-serif; background-image: url('/assets/noise-texture.svg'); @apply grid bg-gray-950 bg-repeat text-gray-50; } .glass-container { position: relative; }...

View Article

Svelte/Typescript error : "unexpected token" during type declaration

So I have a Svelte application with TypeScript enabled but now I am having an issue for running it :[!] Error: Unexpected token (Note that you need plugins to import files that are not...

View Article


Is there a way to use Tauri's `invoke` function in a web worker?

I want to know if it is possible to run invoke from Tauri, in a web worker. I am using Tauri and Svelte.When I try to use invoke from a web worker, I get this error:chunk-NMUKSDLG.js:1 Uncaught...

View Article

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


requests on django api by javascript with CORS error

I have a web application for many years that uses Django and Django Rest Framework. The API is used by a python application and it works correctly:import requestsresponse =...

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 do you type check injected child component in svelte?

I was wondering if you could do a type check on a child component that is injected into a parent component in Svelte?So for example, if I wanted to do the following, but where the child is only allow...

View Article

Making class instance reactive in Svelte using stores

I am learning Svelte by creating simple app.The logic is written using classes. The idea is, that all the data needed comes from class instance properties. Instances should not be instantiated more...

View Article


Svelte 5: TypeError [Error]: entry.default.render is not a function

I am trying to upgrade a svelte app from version 3 to version 5. And I am running into this issue.node:internal/event_target:1094 process.nextTick(() => { throw err; }); ^TypeError [Error]:...

View Article


Is this the right way to create a Svelte 5 store with two-way binding to a...

This is how I used to do it in Svelte 4:// $lib/firebase.tsexport function writableRealtimeStore<T>() { let unsubscribe: () => void = () => {} let objectRef: any const store = writable<T...

View Article

Initializing a custom Svelte store asynchronously

BackgroundI am attempting to develop a cross-platform desktop app using Svelte and TauriWhen the app starts i need to load a settings.json-file from the filesystem into a custom Svelte store.It needs...

View Article

How can I reset the jsdom instance when using vitest in order to test a...

I'd like to do some integration testing of my svelte+page.js-based router using vitest, but I'm running into an issue where the jsdom instance only updates correctly once per test file.In the following...

View Article


How to bind a component instance in a type-safe manner in Svelte 5?

I'm following the tutorial provided by the Svelte team in their website!There is this section in the tutorial that basically explains how we can expose certain functionalities from a custom component:...

View Article

Firebase auth currentUser is always null

I am trying to protect a route in web app using load function ,reading the value of currentUser from auth to see if the user is logged in but it is always null. So when I refresh the page I am kicked...

View Article

Svelte SSR: Why is writable store data being retained across multiple requests?

I am developing an application using Laravel, Inertia and Svelte. It's currently running SSR.Here's a simple code snippet that I use to set up the <title> tag in the <head> section, using...

View Article

Access svelte writable located in object

In shadcn ui port for svelte 5 - Select component (using bitsui select) bind:value asks for state(string), but Writable<string> works too as well, so bind:value={$theme or $language} is properly...

View Article



Svelte 5 and page.js routing problem with external state

I tried to use page.js for client side routing within a Svelte 5 application, but encountered a strange phenomenon: When I put the routing logic within the App.svelte component everything works...

View Article




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