Astro and svelte-check
I'm building a frontend project using Astro. For some dynamic components I added svelte as a UI framework.Now I want to integrate svelte-check but the command is failing because of two reasons:First...
View ArticleEmpty Shoelace Select with two way binding in Svelte
I cannot empty previous selection when changing options between related Shoelace Selects in Svelte. I tried to force Shoelace select value but it didn't work, maybe I shouldn't use two-way binding or...
View Articleerror: 'type' attribute cannot be dynamic if input uses two-way binding
I was trying to create an Input component for my project. I want to set type attribute dyamically on input elementBut when i set type attribute dynamically on input i get error saying'type' attribute...
View ArticleButton background color darkens in safari when video autoplaying in Svelte
So I noticed when I added playsinline into the video attributes to enable autoplay, the button below gets darkened and dimmed. This only happens when it's running on safari in on my iphone. I've tried...
View ArticleHow 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 ArticleSveltekit redirect is not working from server side function
I've got a svelte Header component. In this component there's a logout button. When the button is clicked a function is invoked and this function calls a server side function. In this function I've got...
View ArticleSvelte component not forwarding an event
I have a series of 3 Svelte components, one inside the other, and am trying to forward an event from the innermost to the outermost component. However, the event is only triggered on the second, middle...
View ArticleAstro, Typescript and svelte-check
I'm building a frontend project using Astro. For some dynamic components I added svelte as a UI framework.Now I want to integrate svelte-check but the command is failing because of: Type annotations...
View Articlefor loop not running in javascript [closed]
i have a problem with my svelte code. on the line 41 i have a for loop, which doesn't run anything, as it doesn't print out the i variable on the 42 line.here is my code:<script> import Toolbar...
View ArticleConditionally hide scrollbar in svelte
It is kinda easy. I replaced the normal scrollbar with a custom one and want to hide it only when I'm not actively scrolling. I was so thinking about conditional CSS but can't succeed to anything.The...
View ArticleButton not being animated
Stuck on this problem for 2 days, Whenever i click a button in the top bar, it doesnt get animated. its width should increase and its left-border-color should turn green. however that isnt whats...
View ArticleTailwind CSS IntelliSense is not auto-suggesting in VScode inside a svelte js...
It seems that Tailwind CSS IntelliSense is not working every time I start VScode , after reinstalling it works, on the other hand when it works Tailwind CSS IntelliSense is not suggesting unless I...
View ArticleCannot access 'variable_name' before initialization
When using reactive variables by declaring them using the $: syntax, you get the following error.Cannot access 'variable_name' before initializationHere is the code:App.svelte<script> import {...
View ArticleWhat is the best way to implement event handling on multiple list of child...
Let's say I have a to-do list. Each list item has a delete button which will delete the item from list array if clicked. Now we can use these methods.1.//store.tsexport type Item = { text: string; id:...
View ArticleLoad basic Google Map with array of coordinates in SvelteKit
I am new to web development, so also SvelteKit. I am trying to show a Google Map with markers for a list of locations. The locations come from coordinates. I have found a few similar posts here and on...
View ArticleRole based routing-Svelte
I have a use case where routes are the same but the UI for those routes depends on the role selected by the user while setting up an account.Roles are : Business Owner, Fleet manager, Operational...
View ArticleSvelteKit page data doesn't always update when opening new page in the same...
I have a route structure /items/[category]. When the user is browsing /items/category1 and then tries to go to a another page in the same route (eg. /items/category2) the page data usually updates to...
View ArticleSvelte switch/case vs. if logic blocks [closed]
I was wondering whether there are any best practises on when to use a switch/case assignment vs. using if / else if logic blocks in svelte?E.g. if I have an enumexport enum Status { riding = "RIDING",...
View ArticleCookies behavior in `` tag, and fetch inside a `.server.ts` file in SvelteKit?
I attempting to create a SvelteKit application, and I think I am misunderstanding the use of fetch and hooks. When I have a login page, and in the form actions I am able to decode a jwt and add it to...
View ArticleSegment API call not completing execution when placed inside Svelte onMount...
I am currently setting up Segment and ran into a problem that I can't explain. I am trying to execute an async segment method (analytics.identify) inside of my Svelte components onMount lifecycle...
View Article