zulu
zulu
SSolidJS
Created by Lumphammer (Neil de Carteret) on 4/29/2025 in #support
I'm sure this is a stupid question...
right, it will be shallow clone and you are interested in a more deep clone ( like the one you have) your deep clone is fine, as long as your store is actually JSON serializable.
5 replies
SSolidJS
Created by Angius on 4/22/2025 in #support
Preferred way of handling `429 Too Many Requests` with `createResource`?
yeah, I guess hiding the problem might be the 1st issue ( fallback to cache on error) might be acceptable in your use case 2nd issue, is that quote in LocalStorage might be empty there is no guarantee that this request was called before.
4 replies
SSolidJS
Created by Angius on 4/22/2025 in #support
Preferred way of handling `429 Too Many Requests` with `createResource`?
what do you think can be better here? in other words what do you feel like is bad here?
4 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
key points: 1 when you set an object with another object using the store setter. there is a shallow merge
store, setStore = createStore(
{a:{"value":0}})
store, setStore = createStore(
{a:{"value":0}})
let a_before = store.a // {value:0}
setStore('a', {value:1})
let a_after = store.a // {"value":1}

a_before === a_after // true (same object)
let a_before = store.a // {value:0}
setStore('a', {value:1})
let a_after = store.a // {"value":1}

a_before === a_after // true (same object)
if you create an effect on store.a setting the store.a like we did above will not trigger. ( because the setter preforms a shallow merge which does not replace the value of store.a only a value change in the a key, will trigger a tracking of store.a 2 spreading allow the effect to track not just existing keys, but also new keys that may be added in the future. for example
createStore({a: {}}) // the object has no keys
createStore({a: {}}) // the object has no keys
createEffect(()=>{
({...store.a});
console.log("spread store.a")
});
createEffect(()=>{
({...store.a});
console.log("spread store.a")
});
if we set a new value in store.a now
setStore('a', {value:1}) // the "value" key was added
setStore('a', {value:1}) // the "value" key was added
we will see the effect rerun and print "spread store.a" there is still a shallow merge, but the ... force solid to track changes to the object itself. in other words it tracks all top level changes to the object we destructed/spread 3 setting a key of a store with an alternating types object TO non object {} => "" or non object TO object null => {} will trigger the effect, because there is no shallow merge between object and non object value like ( 1 and {} can not be merged ) so here the value of the key is replaced and the effect will re run
createEffect(()=>store.a)
createEffect(()=>store.a)
[store, _] = createStore({a: null})



// store.a => null

setStore('a', {value:0})

// store.a => {value:0}

// will trigger an effect on store.a
// because the store.a changed
[store, _] = createStore({a: null})



// store.a => null

setStore('a', {value:0})

// store.a => {value:0}

// will trigger an effect on store.a
// because the store.a changed
31 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
31 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
I just know the destruct access/read each key in the object you destruct, so each key is tracked similar to what console.log does. where it access all keys is that what you meant ?
31 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
also console.log in effects might need a warning in docs it is a source of discrepancies in the learning process https://discord.com/channels/722131463138705510/722131463889223772/1359995272637452378
31 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
spread operator in this case the spread is like a short cut for iterating over the object or even array keys/values top level
31 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
console.log does more than a prop access
31 replies
SSolidJS
Created by lemonad on 4/19/2025 in #support
createEffect vs createEffect + on
31 replies
SSolidJS
Created by SkyLissh on 4/11/2025 in #support
SSR blank page
good, you deleted, change your access token
58 replies
SSolidJS
Created by SkyLissh on 4/11/2025 in #support
SSR blank page
bad code delete it all
58 replies
SSolidJS
Created by grobitto on 4/9/2025 in #support
Possible bug? Solidjs lazy() caches network errors
good luck
11 replies
SSolidJS
Created by grobitto on 4/9/2025 in #support
Possible bug? Solidjs lazy() caches network errors
No description
11 replies
SSolidJS
Created by grobitto on 4/9/2025 in #support
Possible bug? Solidjs lazy() caches network errors
Yeah, it is trickier than I first assumed vite, does not allow import() with an expression or a variable you can use this /* @vite-ignore */ on the import to tell vite not to touch that import then make your component a manual chunk, with a predictable name.
11 replies
SSolidJS
Created by grobitto on 4/9/2025 in #support
Possible bug? Solidjs lazy() caches network errors
let greetingError: Error | undefined = new Error('Load pending');
let Greeting: Component<{ name: string }>;

let reqId=0;
let loaded = false;


const resetGreeting = () => {
if (!greetingError) return;

Greeting = lazy(() => {
greetingError = undefined;
let cacheBust = reqId > 0 && !loaded ? `?r=${reqId}` : ''
const p = import(`./greeting${cacheBust}`);
p.catch((e) => {
greetingError = e
reqId++
});
p.then(()=>loaded=true)

return p;
});
};
resetGreeting();
let greetingError: Error | undefined = new Error('Load pending');
let Greeting: Component<{ name: string }>;

let reqId=0;
let loaded = false;


const resetGreeting = () => {
if (!greetingError) return;

Greeting = lazy(() => {
greetingError = undefined;
let cacheBust = reqId > 0 && !loaded ? `?r=${reqId}` : ''
const p = import(`./greeting${cacheBust}`);
p.catch((e) => {
greetingError = e
reqId++
});
p.then(()=>loaded=true)

return p;
});
};
resetGreeting();
cache busting might work like this, the tricky part might be triggering the reset.
11 replies
SSolidJS
Created by sean on 4/6/2025 in #support
What's the most common way (or the idiomatic way) of refreshing access tokens in a Solid.js SPA?
Ok cool, I know about locks but didn't know they started using this new terminology.
8 replies
SSolidJS
Created by sean on 4/6/2025 in #support
What's the most common way (or the idiomatic way) of refreshing access tokens in a Solid.js SPA?
"Leader page election" seem like an over kill a simple lock on the resource is fine
8 replies
SSolidJS
Created by sean on 4/6/2025 in #support
What's the most common way (or the idiomatic way) of refreshing access tokens in a Solid.js SPA?
I will not go with timer based solution whatsoever one reason is that refresh logic might run more than you actually need. ( for idle application ) 2nd is that timeout might not be accurate, and still need blocking logic if you don't want requests to fail. so better to solve one problem and not 2
8 replies
SSolidJS
Created by sean on 4/6/2025 in #support
What's the most common way (or the idiomatic way) of refreshing access tokens in a Solid.js SPA?
you need to put some logic in your token getter and fetcher getToken 1. if the token is valid(non-expired) return it 2. if the token expired, return a promise and start the refresh logic( refreshToken). 3. in the fetcher, await the getToken before fetching 4. if a response fails due to expired token start the refresh logic. while refreshing getToken will return the promise ( you then initiate a retry logic, which will await the getToken until the refresh process is done) refreshToken should guard itself to only run if not already running.
8 replies