Chris, the 0.5x engineer
Chris, the 0.5x engineer
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Thanks!
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
The modal seems to always exists once the session has been acquired.
True and this was a side effect of my debugging journey. I'll be restoring the expected behaviour which is, if the modal is closed, it's not being rendered AT ALL
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Glad I can ship my feedback modal today 🔥
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Thanks y'all! Chatting with y'all helped a lot lol. I just had to be vocal about it
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
The reconcile mechanism of tanstack query for Solid
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Ok gentlemen I found the culprit
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Yep I'm working on it, tbh no success atm
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
I KNOW RIGHT
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
My session.data coming from Tanstack-Query, is a proxy object
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Now there's only one feedback modal
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
No description
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
No description
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Yessir, give me one sec I'll be sharing my console output for all the scenarios
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Oh yeah using a ternary condition to render when session.data is defined fixes my issue
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
I was able to identify where it does come from, the <Show> callback is runnig TWICE!
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
@peerreynders I'm thinking the same thing!
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Sure @jer3m01
export default function Session() {
const params = useParams<{ id: string }>();
const queryClient = useQueryClient();
const sessionId = () => params.id;

const { session, nextQuestion, clearQuestion, endSession, rateSession } =
useSession(sessionId);

onMount(() => {
console.log("{DEBUG}", "Mount Session page");
console.log("{DEBUG}", "Initial data value", session.data);
});

createEffect(() => {
console.log("{DEBUG}", "UPDATED SESSION DATA", session.data);
});

return (
<AppPageContainer>
<Show when={session.data}>
{(sessionData) => {
console.log(" ======== Executing show callback with ", sessionData());
return (
<>
<FeedbackModal
open={
Boolean(sessionData().doneAt) &&
!sessionData().ratingSubmitted
}
sessionId={sessionData().id}
// onDismiss={() => rateSession.mutate(null)}
// onSubmit={(data) => rateSession.mutateAsync(data)}
// isSubmitting={rateSession.isPending}
// isSuccess={rateSession.isSuccess}
/>
</>
);
}}
</Show>
</AppPageContainer>
);
}
export default function Session() {
const params = useParams<{ id: string }>();
const queryClient = useQueryClient();
const sessionId = () => params.id;

const { session, nextQuestion, clearQuestion, endSession, rateSession } =
useSession(sessionId);

onMount(() => {
console.log("{DEBUG}", "Mount Session page");
console.log("{DEBUG}", "Initial data value", session.data);
});

createEffect(() => {
console.log("{DEBUG}", "UPDATED SESSION DATA", session.data);
});

return (
<AppPageContainer>
<Show when={session.data}>
{(sessionData) => {
console.log(" ======== Executing show callback with ", sessionData());
return (
<>
<FeedbackModal
open={
Boolean(sessionData().doneAt) &&
!sessionData().ratingSubmitted
}
sessionId={sessionData().id}
// onDismiss={() => rateSession.mutate(null)}
// onSubmit={(data) => rateSession.mutateAsync(data)}
// isSubmitting={rateSession.isPending}
// isSuccess={rateSession.isSuccess}
/>
</>
);
}}
</Show>
</AppPageContainer>
);
}
30 replies
SSolidJS
Created by Chris, the 0.5x engineer on 5/8/2024 in #support
OnMount fired twice for the same component
Modal root is a component that renders a <dialog>
30 replies