Some Afk Guy
Some Afk Guy
SSolidJS
Created by Some Afk Guy on 2/15/2025 in #support
reactivity works in vite dev but fails in vite build
Thank you for the help @peerreynders :cheers: I have fiddled with your fiddle to more accurately represent my file structure. https://playground.solidjs.com/anonymous/27b4ad67-6edc-488d-95db-1f93410043ad One think i thing i think i am learning from this process is that the previous toggleMenu had the potential to cause reactivity issues
const toggleMenu = (menu: ClosableMenu) =>
(solidStore.openMenus[menu] ? closeMenu : openMenu)(menu);
const toggleMenu = (menu: ClosableMenu) =>
(solidStore.openMenus[menu] ? closeMenu : openMenu)(menu);
The linter was giving me warnings since solidStore.openMenus[menu] is being referenced as a dynamic value, but was not being created in a reactive context so could cause issues during the build? But despite my attempts at understanding whats going on, I could not get the window to show in the build version of the app. I think im gonna try to restart from a blank new vite project because the playground at least shows a POC that my approach should work.... I tried usingContext/memos and signals just to see all of these variants work, but never in build 😦
7 replies
SSolidJS
Created by Some Afk Guy on 2/15/2025 in #support
reactivity works in vite dev but fails in vite build
my latest refactor i tried making signals out of each property, but it still doesnt work despit console logging
type MenuRenderer = {
component: JSX.Element
field: ClosableMenu
signal: Accessor<boolean>
setSignal: Setter<boolean>
}

const menus: MenuRenderer[] = [
{
component: <Settings />,
field: 'settings'
}
] as never

const Router: Component = () => {
menus.forEach((menu) => {
;[menu.signal, menu.setSignal] = createSignal(false)
})
createEffect(() => {
menus.forEach((menu) => {
if (menu.signal() != solidStore.openMenus[menu.field]) menu.setSignal(solidStore.openMenus[menu.field])
})
console.log('router outside: settings is', solidStore.openMenus.settings)
})
return (
{menus.map(
(menu) =>
<Show when={menu.signal()}>{menu.component}</Show>
)}
{/* one extra one just to be explicit still doesn't work */}
<Show when={menus[0].signal()}><Settings /></Show>
{/* one extra one using the explict store statestill doesn't work */}
<Show when={solidStore.openMenus.settings}><Settings /></Show>
)
type MenuRenderer = {
component: JSX.Element
field: ClosableMenu
signal: Accessor<boolean>
setSignal: Setter<boolean>
}

const menus: MenuRenderer[] = [
{
component: <Settings />,
field: 'settings'
}
] as never

const Router: Component = () => {
menus.forEach((menu) => {
;[menu.signal, menu.setSignal] = createSignal(false)
})
createEffect(() => {
menus.forEach((menu) => {
if (menu.signal() != solidStore.openMenus[menu.field]) menu.setSignal(solidStore.openMenus[menu.field])
})
console.log('router outside: settings is', solidStore.openMenus.settings)
})
return (
{menus.map(
(menu) =>
<Show when={menu.signal()}>{menu.component}</Show>
)}
{/* one extra one just to be explicit still doesn't work */}
<Show when={menus[0].signal()}><Settings /></Show>
{/* one extra one using the explict store statestill doesn't work */}
<Show when={solidStore.openMenus.settings}><Settings /></Show>
)
the solid never rerenders with the correct state perhaps this is an issue with my configuration of vite build... :Thinking3D:
7 replies
SSolidJS
Created by Some Afk Guy on 2/15/2025 in #support
reactivity works in vite dev but fails in vite build
for all future searchers reactivity is wonky in routes i will post a summary when i fix this bug lol nope.mp3
7 replies