Casacobra
Casacobra
SSolidJS
Created by Casacobra on 10/1/2024 in #support
Safari Video Not AutoPlaying when inside a Suspense
yes, this actually fixed the issue, thank you @Madaxen86
12 replies
SSolidJS
Created by Casacobra on 10/1/2024 in #support
Safari Video Not AutoPlaying when inside a Suspense
You'll notice if you remove the controls, it won't render in safari if inside the Suspense, then try it outside suspense without controls and it will render on safari
12 replies
SSolidJS
Created by Casacobra on 10/1/2024 in #support
Safari Video Not AutoPlaying when inside a Suspense
Hey Max yeah the main concern is I don’t want controls to be set to true I need it without controls and safari policy or iOS policy is you can play a video automatically as long as it’s muted
12 replies
SSolidJS
Created by Casacobra on 10/1/2024 in #support
Safari Video Not AutoPlaying when inside a Suspense
@Madaxen86 yeah unfortunately that didn't do anything 😦
12 replies
SSolidJS
Created by Casacobra on 10/1/2024 in #support
Safari Video Not AutoPlaying when inside a Suspense
Sorry just got back from work, will try this now and keep you updated! Thanks 😄
12 replies
SSolidJS
Created by Casacobra on 7/26/2024 in #support
Best approach for using createResource
@mdynnl I think I know the issue... thanks for getting back to me! I have the following app.tsx
export default function App() {
return (
<>
<Router
root={(props) => (
<>
<MetaProvider>
<Title>Supaflags</Title>
<ColorModeScript storageType={storageManager.type} />
<ColorModeProvider storageManager={storageManager}>
<AuthProvider>
<FlagsProvider>
<AuthGuard>{props.children}</AuthGuard>
</FlagsProvider>
</AuthProvider>
</ColorModeProvider>
</MetaProvider>
</>
)}
>
<Route path="/" component={AuthLayout}>
<Route path={["/", "/flags"]} component={Flags} />
<Route path="/flags/:id" component={FlagDetails} />
<Route path="/settings" component={Settings} />
</Route>
<Route path="/auth" component={DefaultLayout}>
<Route path="/signin" component={SignIn} />
<Route path="/signup" component={Signup} />
</Route>
<FileRoutes />
</Router>
<Toaster />
</>
)
}
export default function App() {
return (
<>
<Router
root={(props) => (
<>
<MetaProvider>
<Title>Supaflags</Title>
<ColorModeScript storageType={storageManager.type} />
<ColorModeProvider storageManager={storageManager}>
<AuthProvider>
<FlagsProvider>
<AuthGuard>{props.children}</AuthGuard>
</FlagsProvider>
</AuthProvider>
</ColorModeProvider>
</MetaProvider>
</>
)}
>
<Route path="/" component={AuthLayout}>
<Route path={["/", "/flags"]} component={Flags} />
<Route path="/flags/:id" component={FlagDetails} />
<Route path="/settings" component={Settings} />
</Route>
<Route path="/auth" component={DefaultLayout}>
<Route path="/signin" component={SignIn} />
<Route path="/signup" component={Signup} />
</Route>
<FileRoutes />
</Router>
<Toaster />
</>
)
}
Then I have an AuthGuard that basically checks whether you have an auth session or not. If you visit / and have no session it redirects you to the login page auth/login.tsx I think the problem here is, it automatically runs createResource on the / page first then directs you to auth/login.tsx when you then log in it then directs you back to / which runs this twice. This is the AuthGuard page:
export default function AuthGuard(props: ComponentProps<"div">) {
const navigate = useNavigate()
const location = useLocation<LocationState>()
const rootPathName = "/"
const loginPathName = "/auth/signin"
const [isLoading, setIsLoading] = createSignal(false)
const [initialPath, setInitialPath] = createSignal(location.pathname)

const checkSession = async () => {
setIsLoading(true)
const { data } = await supabase.auth.getSession()
const session = data?.session

if (!session) {
if (location.pathname !== loginPathName) {
setInitialPath(location.pathname)
setSession(null)
}
navigate(loginPathName, { replace: true, state: { from: initialPath() } })
} else {
const redirectTo = location.state?.from || rootPathName
if (location.pathname === loginPathName) {
navigate(redirectTo, { replace: true })
}
}

setIsLoading(false)
}

checkSession()

return (
<Show when={isLoading()} fallback={<>{props.children}</>}>
<LoadingLayout />
</Show>
)
}
export default function AuthGuard(props: ComponentProps<"div">) {
const navigate = useNavigate()
const location = useLocation<LocationState>()
const rootPathName = "/"
const loginPathName = "/auth/signin"
const [isLoading, setIsLoading] = createSignal(false)
const [initialPath, setInitialPath] = createSignal(location.pathname)

const checkSession = async () => {
setIsLoading(true)
const { data } = await supabase.auth.getSession()
const session = data?.session

if (!session) {
if (location.pathname !== loginPathName) {
setInitialPath(location.pathname)
setSession(null)
}
navigate(loginPathName, { replace: true, state: { from: initialPath() } })
} else {
const redirectTo = location.state?.from || rootPathName
if (location.pathname === loginPathName) {
navigate(redirectTo, { replace: true })
}
}

setIsLoading(false)
}

checkSession()

return (
<Show when={isLoading()} fallback={<>{props.children}</>}>
<LoadingLayout />
</Show>
)
}
I then made the index page in app.tsx lazy load the component for the index page that basically fetches the resource, this definitely doesn't run the fetcher twice and fixes the issue, but its not what i wanted. Do you see what the issue could be here by any chance?
3 replies
SSolidJS
Created by Casacobra on 7/20/2024 in #support
Outlet issue on routes
Thanks guys, I fixed it I was basically using an older version of solid-start 😄
6 replies
SSolidJS
Created by Casacobra on 5/21/2023 in #support
Reactivity when passing props down not reactive on nested component
Yeah I tried this too and for some bizarre reason it isn’t playing nicely! Thanks for the response. I’ll continue debugging and see where I get to!
17 replies
SSolidJS
Created by Casacobra on 5/21/2023 in #support
Reactivity when passing props down not reactive on nested component
Please bare in mind, which I forgot to say. level is constantly looping as in using requestAnimationFrame...
17 replies
SSolidJS
Created by Casacobra on 5/21/2023 in #support
Reactivity when passing props down not reactive on nested component
It accesses one signal called [level, setLevel]
17 replies
SSolidJS
Created by Casacobra on 5/21/2023 in #support
Reactivity when passing props down not reactive on nested component
But if i move the code to the root component, it's reactive, with the exception of using .map
17 replies
SSolidJS
Created by Casacobra on 5/21/2023 in #support
Reactivity when passing props down not reactive on nested component
@foolswisdom Exactly, x and y do not update for some bizarre reason
17 replies
SSolidJS
Created by Casacobra on 5/21/2023 in #support
Reactivity when passing props down not reactive on nested component
@foolswisdom If I do it in the root component, ParentComponent as a map it works and reactivity works, the minute i move it to a child component is when it does not become reactive when I use <For> or map... It's so strange..
17 replies
SSolidJS
Created by Casacobra on 12/22/2022 in #support
Solid Cache
@lxsmnsyc is this the right approach, by any chance? Sorry to bother you...
53 replies
SSolidJS
Created by Casacobra on 12/22/2022 in #support
Solid Cache
I tried doing something along these lines, but doesn't seem to work: /products/new.tsx
const refresh = useRefreshCacheBoundary()
return (
<button
onClick={async () => {
await saveProduct(data())
refresh(false)
navigate('/products')
}}
>
Save
</button>
)
const refresh = useRefreshCacheBoundary()
return (
<button
onClick={async () => {
await saveProduct(data())
refresh(false)
navigate('/products')
}}
>
Save
</button>
)
53 replies
SSolidJS
Created by Casacobra on 12/22/2022 in #support
Solid Cache
Creating separate cache boundaries for each route or refresh the cache on route change?
53 replies
SSolidJS
Created by Casacobra on 12/22/2022 in #support
Solid Cache
Hey @lxsmnsyc not too sure how the cache stuff works. I have a /products route and then a /products/new route. When creating a new product and successful I am navigating back to /products then want to invalidate and refresh/invalidate all cache. Is there a way to handle this solution?
53 replies
SSolidJS
Created by Casacobra on 1/4/2023 in #support
Authorization still triggering fetch when using conditional routing for AuthProvider
@lxsmnsyc thanks for your reply! One thing I've noticed and I'm not too sure why but the refresh cache doesn't work at all in my use case
6 replies
SSolidJS
Created by Casacobra on 12/22/2022 in #support
Solid Cache
So, whenever I use a useCacheBoundaryRefresh, does this refresh the entire cache within that boundary
53 replies