How to monitor changes to a Svelte writeable?
Currently I have this code:File A.js:import { writable, derived } from "svelte/store";export const notify = writable(false)File B.svelte:import { notify } from '$lib/store';$effect(() => { if...
View ArticleHow to display Portable Text block content images in SvelteKit
I'm trying to render a blog post from Sanity Studio in my SvelteKit project.Currently, all of the text etc is being displayed, but images within the block content aren't. Below is what I have tried so...
View ArticleHow to properly wrap a WebComponent in Svelte(kit) 5
I need to use some WebComponents at $JOB inside SvelteKit, built as a SPA.Supposing that <my-web-component> has:API attributes (like disabled, but custom ones)MethodsEventsWhat could be the best...
View ArticleEscape Root Layout Svelte Sveltekit
According to the new routing system you can now group routes and have specific layout files in each group. These files inherit for their parent layout files. You can omit this, by using...
View ArticleSvelte KaTeX automatic line breaks
I am generating random math expressions and displaying them on a website using Svelte and KaTeX. Sometimes, the generated formula becomes too long for its container, but instead of automatically...
View Articlewails dev Call from terminal unable to find wails.json
I am using a copy of the Wails + Svelte hello world app and I am using it to do a Svelte tutorial.(Tutorial Link)https://svelte.dev/tutorial/svelte/nested-componentsUp until I reached this particular...
View ArticleHow to handle expired http requests in Svelte?
The way I have it set up is a class that handles all the api calls. In this class I keep a map for GET requests, key is url, value is AbortController.If a request is being sent and another one of the...
View ArticleAccessing SvelteKit vite local development server from Android phone
I have built a landing page with Sveltekit, and I want to test the website on my Android phone while developing the mobile view, is there any way to do this?Before using Svelte (when I used plain HTML,...
View ArticleSvelte multiple small components vs regular html elements
Does it affect performance having svelte components instead of regular HTML elements, for small things like buttons, links etc?Wrapping these elements in a svelte component would make it more...
View ArticleAccess URL query string in svelte
How should I access the the query string parameters from svelte? I'd like my script to behave differently when "?beta" has been appended to the URL.My intuitive approach would be to use the standard...
View ArticleHow do I use tailwindcss @apply directive inside a svelte component
This works:<div class="list p-2" />This doesn't work:<style lang="postcss"> @tailwind base; @tailwind components; @tailwind utilities; @layer components { .list { @apply p-2; }...
View ArticleAstro + Svelte: Imported Svelte Components Have No Type Checking in VSCode
I'm using VSCode, and I've noticed that when I import Svelte components into my Astro components, they are typed as any, and TypeScript does not type-check the props.I have set up my project...
View ArticleHow to set dynamic html tag according to props in Svelte
I'm creating a Heading component in svelte as a part of learning the basics of this framework. The component behavior is pretty straight-forward. The component will have a prop named level, which will...
View ArticleSvelte 5 Unsafe State Mutation at Tree Component
I need help with Svelte components. I've built a tree that should allow users to check nodes and update related nodes. When a node is checked, its parents and children should react accordingly....
View ArticleSvelte input blur triggered when element is focused
Maybe its not related to svelte, but if do some DOM changes after input is focused, for example<input onfocus={() => toggleVisibiltyOfOtherElement = true } onblur={() => console.log("blur")}...
View ArticleHow to Create my own Svelte Embed Component
Certain platforms like GitBook allow you to insert an embed URL, like https://www.youtube.com/embed/eGUEAvNpz48, and it displays as a component on that website, as seen here:I want to create my own...
View ArticleHaving trouble promisifying Google ReCAPTCHA v2 Invisible in Svelte 5 /...
I have been trying to get Google ReCAPTCHA v2 invisible work with sveltekit 2 / svelte 5 and I have run into a few issuesFirst of all this is the documentation for how to load CAPTCHA in your...
View ArticleHow to trigger LayoutServerLoad on every navigation in SvelteKit?
I want to add a JWT verification/refresh in +layout.server.ts that is called on every navigation action.I've got following code and noticed that the console.log() statement is only ran, when I reload...
View ArticleSvelte (vite?) installing static resources
How can I make static resources (e.g. fonts/images) in a node_modules package available in a Svelte application?I'd like the process to be automatic so you don't have to do anything manual if you use a...
View ArticleParameters in svelte action not reactive
Svelte action that does things when keys are pressed:import type { Action } from "svelte/action"export const keys: Action<HTMLElement, boolean> = (node, active?: boolean) => { function...
View ArticleInertiaJS: keep current component
I can't wrap my head around how InertiaJS works...I am using a vanilla PHP backend solution, so all the magic revolving around frameworks like Laravel can't help me.I would like to submit a form (using...
View ArticleHow to use local static images in Svelte
I was following the tutorial (https://svelte.dev/tutorial/dynamic-attributes) to import local image files. But it didn't work. The image was not found in the app.Where do I need to locate these images...
View ArticleWhy doesn't Svelte record signals individually?
I'm wondering about internals of Svelte to properly design my application to have maximum efficiency (I may deal with (tens?) of thousands of elements to update, so efficiently does matter), notably...
View ArticleSvelteKit container on Azure App Service page rewrite issue /project/1 being...
I have a SvelteKit with Svelte 5 application which I am deploying to the Azure App Service inside of a Docker container.I have routes with a parameter set up like:route/ - project -...
View ArticleSvelte 5 memory leak in simple example
I'm encountering many memory leaks when using both Svelte 4 and 5 on reasonably complex projects, and having trouble identifying what I'm doing wrong.Here is an extremely simplified Svelte 5 example...
View Articlebinding svelte value to knockoutJS
I am integrating svelte into an old knockout js application, and I thought it would be a good idea to replace the inputs with svelte components.So I created a svelte component: interface Props { value:...
View ArticleHow to configure VS Code to run npx vite dev when debugging
I am new to VS Code and JavaScript, and I am trying to make a simple app using Vite and Svelte, but I have a problem which I can't seem to resolve. (My code is currently just the default code given...
View ArticleGoogle App Engine - endpoint "GET /_ah/start HTTP/1.1" 500
When changing my applications scaling to manual I kept getting this error in the console Error: Cannot find module '/workspace/index.js' followed by multiple errors of "GET /_ah/start HTTP/1.1" 500Tech...
View ArticleHow do I upgrade to more recent versions of Svelte?
Two questions.If I have Svelte 5, how do I upgrade to more recent versions of Svelte 5?eg 5.0.0. to 5.1 etcHow do I even know what releases there have been?
View ArticleWhy does Chrome black out, or crash with "aw, snap - out of memory" when...
I'm developing a Svelte-based Javascript single-page app with a lot of Apache ECharts displays in it that is fairly heavy in both DOM elements and array data, but generally stays in the 400-500MB range...
View Article