3,012 questions
0
votes
3
answers
59
views
Cannot render a value from a Float32Array
I am trying to render an element from a Float32Array using Svelte.
let laterTimeIndex = hourlyWeatherData.time
.find((timeData: Date) =>
timeData.getHours() === (currentTime + 5) % 24
...
2
votes
1
answer
42
views
Is there a way to exclude specific dates using Flowbite-Svelte's Datepicker?
I am working on a simple website, using SvelteKit. For the UI, I use Flowbite-Svelte and some of its components.
During early stages of development, I just used the availableFrom property. Now I want ...
0
votes
1
answer
58
views
Is this binding_property_non_reactive really correct?
Reproduction
https://svelte.dev/playground/2c859a9c620b4b9a8422c2596df4c209?version=5.42.3
Using Svelte (v5.42.3) and Svelte Kit (v2.48.2) and @tanstack/svelte-query (v6.0.3).
If I have the component ...
1
vote
1
answer
78
views
Creating new SvelteKit project fails with "Failed to install dependencies"
I enter "npx sv create" as I have done successfully numerous times before, and choose all defaults. The usual spinner begins, but this error appears. I have rebooted, tried different clean ...
0
votes
2
answers
58
views
SvelteKit form inside a modal won’t submit to +page.server.js action
So I have a SvelteKit project with the following project structure:
lib/
├─ components/
│ └─ my_module/
│ └─ my_resource/
│ ├─ CreateObjectButton.svelte ← Button component (important by ...
2
votes
1
answer
61
views
how to create a function that recieves a path compatible with the resolve fn
I'm creating a component that will receive several RouteId and create links
I want to use the resolve fn to validate them
see: https://svelte.dev/docs/kit/$app-paths#resolve
If I declare a prop (or a ...
1
vote
1
answer
251
views
Tauri window opens fine on macOS but hangs with blank window on Windows (no logs after #2)
I’m developing a desktop app with Rust + Tauri (v2.5) + SvelteKit.
On macOS my command for opening a new settings window works perfectly. On Windows however, the app freezes when building the window: ...
2
votes
2
answers
156
views
How to fetch on hover like SvelteKit in Next.js
I wrote a site in SvelteKit and the navigation between pages felt really fast because, SvelteKit on hover, runs the load functions of the pages, downloads everything to the client and on click, it ...
0
votes
1
answer
110
views
Error: column "displayUsername" of relation "users" does not exist in better-auth 1.3.6 and 1.3.7
I am getting the following error when I try to update a username in better-auth from a sveltekit client
# SERVER_ERROR: error: column "displayUsername" of relation "users" does ...
1
vote
0
answers
45
views
Page won't start painting until the promise is fulfilled in load function
I just started learning Svelte. Here's a small problem I encountered recently:
I’m trying to use {#await} in SvelteKit to simulate a loading state while waiting for server data.
Here’s my setup:
<!-...
1
vote
1
answer
56
views
How to access exports of CDN module loaded in app.html?
I'm importing a module in my app.html as follows
<body data-sveltekit-preload-data="hover">
<script type='module' src='https://cdn.jsdelivr.net/npm/@owlbear-rodeo/[email protected]/+esm'...
0
votes
1
answer
80
views
Earliest a client-side import can be executed in SvelteKit application?
Context
I have a Svelte 5 + SvelteKit application (App A) that is loaded into an iframe within a different app (App B).
When the iframe loads, App B emits a one-time message event with id=OBR_READY.
...
1
vote
0
answers
73
views
How to reactively respond to form.success updates from +page.server.ts actions in +pages.svelte
I have a SvelteKit setup where I perform a fetch request inside an action in +page.server.ts. Specifically, I define an addSender action that handles a POST request to an external API and returns an ...
1
vote
1
answer
106
views
Why not call a fetch function eagerly when it is not even awaited
I get this message in my terminal when running my svelte frontend:
Avoid calling fetch eagerly during server side rendering — put your fetch calls inside onMount or a load function instead
I ...
38
votes
7
answers
33k
views
Cross-site POST form submissions are forbidden
My sveltekit app has a form which sends a POST request to server. The app is working fine on dev server but when I build and run the app it fails to send the form data via POST request. It shows the ...
62
votes
4
answers
146k
views
npm run dev --host network: not exposed
I want to expose my svelte app on LAN using the npm run dev --host command but it shows:
> [email protected] dev
> svelte-kit dev
SvelteKit v1.0.0-next.295
local: http://localhost:3000
...
0
votes
2
answers
472
views
'state' is not defined svelte (missing-declaration)
In the code listed below I am getting an error:
[svelte-5] 'state' is not defined svelte (missing-declaration)
The app was created using npx sv create app. I added the component file named ...
-3
votes
1
answer
79
views
Is this object created only once or every time I import it? [duplicate]
Since I'm having a bug that I can't figure out, a cold doubt has assailed me:.
I have the below code in a Svelte 5 SvelteKit app.
And I'm importing import { queryClient } from './src/query.ts from ...
0
votes
2
answers
798
views
Svelte 5 custom dispatch Object literal may only specify known properties
I am trying to create a simple dispatcher but I keep getting error that it doesnt recognize the dispatcher that i am creating.
function dispatchChange() {
dispatch('treeChange', {
id: ...
31
votes
5
answers
17k
views
Sveltekit + Typescript: Environment variables build error
I want to use environment variables in my Sveltekit app - it works fine on dev server, but I get this build error:
Error: 'PUBLIC_KEY' is not exported by $env/static/public, imported by src/routes/+...
0
votes
1
answer
55
views
Stackblitz and supabase - can't get .env to work
Using the sveltekit starter on stackblitz, I've installed the supabase package.
In the root directory I have a .env file with SUPABASE_URL and SUPABASE_KEY and the values are filled in.
In src/lib/...
11
votes
6
answers
8k
views
Disable 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 -->
&...
21
votes
9
answers
38k
views
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 ...
1
vote
1
answer
153
views
How to mock $env/static/public with vitest?
I'm using an env variable MY_VAR that I use from $env/static/public
import { MY_VAR } from '$env/static/public';
export const myVar = MY_VAR === 'true';
I'd like to mock it in some tests, to support ...
16
votes
7
answers
31k
views
Tailwind and Vite warnings: "didn't resolve at build time, it will remain unchanged to be resolved at runtime"
I'm using the following combination of technologies:
SvelteKit (1.5.0, using TypeScript), with Vite (4.0.0) as the build tool that comes with SvelteKit)
Svelte's adapter-static (2.0.1) for publishing ...