uchiha_savior
uchiha_savior
SSolidJS
Created by uchiha_savior on 11/6/2023 in #support
cant set signal exported from a context
I've recreated a simple example based on my code: https://stackblitz.com/edit/solidjs-templates-dhbcft?file=src%2Fcomponents%2Fcontext.tsx,src%2Fcomponents%2FCardWrapper.tsx In context.tsx I have a signal inTransit which tells if some HTTP request is in progress. It works fine in the submit function which is in the context, but when I use setInTransit in a createEffect in another component (CardWrapper.tsx), it does not works as expected. What I expect is to keep seeing "Processing..." till the createEffect in CardWrapper.tsx is also done executing after clicking the submit button. Any help or hints would be appreciated, thanks!
6 replies
SSolidJS
Created by uchiha_savior on 4/14/2023 in #support
Derived value in event handler causing router error
Error: Make sure your app is wrapped in a <Router /> when calling an eventhandler. Just trying to log a derived signal/prop in my buy function. The values from product() get printed correctly in my DOM
const product = () => props.product
const [qty, setQty] = createSignal(0)

function buy() {
console.log(product())
// console.log(qty())
}
const product = () => props.product
const [qty, setQty] = createSignal(0)

function buy() {
console.log(product())
// console.log(qty())
}
The second console.log works fine. But the first throws
Uncaught Error: Make sure your app is wrapped in a <Router />
at invariant (utils.js?v=8381e9f0:28:15)
at useRouter (routing.js?v=8381e9f0:9:32)
at useRoute (routing.js?v=8381e9f0:11:75)
at useParams (routing.js?v=8381e9f0:37:32)
at product (ProductDetail.tsx:11:22)
Uncaught Error: Make sure your app is wrapped in a <Router />
at invariant (utils.js?v=8381e9f0:28:15)
at useRouter (routing.js?v=8381e9f0:9:32)
at useRoute (routing.js?v=8381e9f0:11:75)
at useParams (routing.js?v=8381e9f0:37:32)
at product (ProductDetail.tsx:11:22)
8 replies