Questions tagged [svelte-store]
The svelte-store tag has no usage guidance, but it has a tag wiki.
svelte-store
247
questions
-1
votes
1
answer
45
views
Adding a readable store to writable store
I'm trying to add a readable store as a default value to a writable store, so that the user will see some default value when he opens the app.
I have one large readable store - taskStore, which ...
0
votes
0
answers
23
views
How to bind Svelte Store when the value inside object?
I have a custom component InputGroup. It can render checkbox or radio type of input. The selected value is always Svelte Store. But the first store is top of scope, the second inside object. I use $: ...
0
votes
0
answers
28
views
Unable to use firebase in svelte
I am trying to add some code to previous github repo but while using firebase after creating a page in src/routes folder I am unable to use it. Do I have to use firebase compat? As that also didn't ...
0
votes
2
answers
46
views
Store with custom method and reactive values
I am building a Svelte component to display a list whose items can be added to a selection. The selection itself is a store:
selectionStore.js
import {writable} from 'svelte/store';
function ...
0
votes
1
answer
16
views
Svelte subscribe to changes using github.com/joshnuss/svelte-local-storage-store
I am quite new to Svelte coming from an IOS background. I am currently trying to build a fairly simple application and am going around in circles trying to get my values to auto update when they are ...
0
votes
2
answers
39
views
How do I pass the value of a store as a prop in Svelte, where the store is an object member?
Suppose I have a list of items with Svelte stores as members, e.g.:
interface Item {
isAvailable: Writable<boolean>;
}
If I have some component with a boolean prop, how do I pass values from ...
0
votes
1
answer
59
views
SvelteKit store undefined when accessed from a different component
I'm attempting to set a store within one Svelte component and access it another. I immediately log the store after setting it (in Component.svelte), and it's what I expect however my reactive ...
0
votes
0
answers
72
views
Svelte Component Errors: Cannot read properties of null (reading 'current'), TypeError: unsubscribe is not a function
I have a component that accesses a svelte store writable but the component just gets rendered before the data arrives into the store variable.
This are the errors
enter image description here
I want ...
0
votes
1
answer
50
views
Why are svelte derived stores always recreated on get()?
Now this is more directed towards Svelte authors I suppose, but I just recently fully realized that derived stores are constantly recreated on get.
Example
<script>
import { derived, get, ...
0
votes
1
answer
231
views
Is there a way to add type safety to page form store in SvelteKit?
I separated my HTML into two files, +page.svelte and Role.svelte. This is so it's cleaner and more maintainable as I will add more svelte files into +page.svelte in the future. Role.svelte contains ...
1
vote
1
answer
132
views
How to force svelte component to mount in an {#if} block
I have a sidebar with collapsible sections that use slots like this:
<Sidebar> // creates writable context
<Searchbar /> // updates context
<Collapsible>
<MyControl ...
0
votes
0
answers
46
views
When using multiple stores in Svelte, the information from one store does not update
I'm having issues with stores in Svelte. Currently, I'm using derived to update a filter as the stores get updated.
Here's an example of the function:
export const FILTERED_SORTED_BIDS = derived([...
0
votes
1
answer
105
views
How 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&...
0
votes
2
answers
714
views
Typed Svelte store with initial value from local storage
I'm trying to implement JWT authentication in my SvelteKit SPA. I'm new to TS (and thus Svelte[Kit]) and there is a lot to learn, so my problem might not strictly be with Svelte and its store system ...
0
votes
0
answers
34
views
Why is the parameter of the callback function in Svelte's `derived` function named with dollar sign?
In Svelte tutorial about derived store, the name of the parameter of the callback function (, which itself is the second argument for the derived function) is prefixed with $. This is also the case in ...