Skip to main content

All Questions

Tagged with
2 votes
0 answers
62 views

sveltekit client - array available sporadically in reactive function

An app showing a list of building systems components with the ability to add a component. Database is Mongodb. +page.js fetches the list, a definition of the table + populates "lookup" lists ...
minisaurus's user avatar
  • 1,196
0 votes
1 answer
47 views

How to use an array from a JS file to a Svelte file

I have a function in a +page.js file that return { props { data } }. Data is an array. However when I try to use it in svelte with export let data It says that it's not an array What should I do ?
Zefus's user avatar
  • 11
0 votes
1 answer
69 views

Is it possible to limit results from Svelte {#each} loop by a certain amount?

I'm using an {#each} loop to showcase data, but I'm curious if Svelte has a way to limit the results by an integer. For example, if I had the following array and loop: const object = [1, 2, 3, 4, 5]; ...
Sam Sabin's user avatar
  • 1,173
1 vote
1 answer
104 views

Svelte: Binding of value inside an array does not work

I created a REPL to illustrate my issue. So I have an array with elements and those elements bind there properties to input fileds. But changing those values does nothing. On log or add all changes ...
Egor Fabricius's user avatar
0 votes
1 answer
54 views

Svelte value assignment does not update

Why doesn't this value assignment work? <script> let numbers = [1, 2, 3, 4]; function addNumber() { numbers = numbers.push(numbers.length + 1); } $: sum = numbers....
Real Quick's user avatar
  • 2,810
0 votes
1 answer
511 views

Duplicate elements in #each Svelte

I have a component on related posts on the Svelte website. It works, but the problem is that it duplicates the articles in the block. That is, for example, if I have three identical tags contained in ...
Лео's user avatar
  • 167
1 vote
2 answers
298 views

How can I limit object from an array in svelte

I'm searching in svelte documentation about this, but I can't get it. What I want is to show only 4 objects from an array For example: let data = [ {id:1, name: 'John'}, {id:2, name: 'Peter'}, ...
Eyad Farah's user avatar
0 votes
2 answers
24 views

Array2 gets set to a array1 unexpectedly in Svelte

For some reason, images2 gets set to the same thing as images1 instead of galleryData.splice(0, 3), this is not what I want to happen. The second console.log(images2) prints what galleryData.splice(0, ...
Ant_Pearl's user avatar
-1 votes
2 answers
62 views

How to play ad at each array time?

I am trying to play/show a video Advertisement(just a h1 tag) at each index value in the array. For example; the first item in the array is 5. So at 5 seconds, I want the video to pause and play an ad....
lache's user avatar
  • 830
2 votes
1 answer
1k views

Toggle add/remove items to a writable array store in Svelte

I have a Svelte store that's a writable array. To begin, I have a separate array of names, and am using that to populate a selection panel the user can click on. The idea is that if they click on the ...
sprucegoose's user avatar
1 vote
3 answers
2k views

Why is Svelte not re-triggering a function and/or rerendering when some variable changes? [duplicate]

I'm relatively new to Svelte and I understand some basic concepts. I know that it's reactive on assignment. But I can't seem to figure out why exactly this doesn't work. Here's a little demo snippet ...
ruky's user avatar
  • 33
0 votes
1 answer
1k views

Drag and Drop Lists - Adding Items at Specific Indexes - Sortable Lists

So I've recently started learning Svelte and I want to create a few lists where items can be dragged and dropped between them. Additionally, I would like to be able to sort / reorder the items within ...
Callum's user avatar
  • 3
0 votes
1 answer
52 views

create array based on number of html elements

My goal is to change the value of activeindex in each of the button elements based on a conditional statement. There are 5 buttons if the flag is true, and there should be 4 when false. However I need ...
lache's user avatar
  • 830
1 vote
0 answers
621 views

infinite Slider in Svelte

Trying to make a Dynamic Slider component with infinite data in both the prev and next buttons. However, I can't get the right Method to get it done. Here You can find the code I wrote. I took the ...
Abdel's user avatar
  • 51
0 votes
3 answers
96 views

Calling array object in src does not work

I have an array : let x = ''; let elements = [ { icon:"Home",name:'Home',page:'Page1' }, { icon:'Cube',name:'New',page:'Page2' }]; I am looping in it: {#each ...
equi's user avatar
  • 164

15 30 50 per page