jack
jack
Explore posts from servers
Aarktype
Created by jack on 3/15/2025 in #questions
onfail without importing config in every file?
Oh I see, I didn't know .assert would behave that same way. Yea I'll just do that, that's more explicit anyway
5 replies
Aarktype
Created by jack on 3/15/2025 in #questions
onfail without importing config in every file?
it's not really clear what my app entry point is in some cases as i have a monorepo, but i'll try and see what happens, thank you
5 replies
Aarktype
Created by jack on 3/11/2025 in #questions
standard schema conforming schema in openauth not working seemingly exclusively with arktype?
thanks!
6 replies
Aarktype
Created by jack on 3/11/2025 in #questions
standard schema conforming schema in openauth not working seemingly exclusively with arktype?
sweet, works with the updated version (i also tried the alternative ^ and it did work too, but i like the inline 🙂 )
6 replies
Aarktype
Created by jack on 3/11/2025 in #questions
standard schema conforming schema in openauth not working seemingly exclusively with arktype?
2.0.4, updating now. was this a known issue?
6 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
(side note: this match function is really cool, and making me rethink what runtime validation actually means a bit. didn't consider ever using zod for something like this when i've used zod in the past instead of arktype, but in hindsight it totally makes sense)
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
yea that is true. will note down potentially for the future
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
i don't really need anything more fancy, just didn't want to hardcode the suffix value
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
ah i didn't think about pulling out the matcher. this looks good to me, thank you!!
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
this is what i've got working
const ImageSource = match({
"string.url & /=s96-c$/": (url) =>
url.slice(0, url.length - constants.googleThumbnailSuffix.length),
"string.url": (url) => url,
default: "assert",
});
const ImageSource = match({
"string.url & /=s96-c$/": (url) =>
url.slice(0, url.length - constants.googleThumbnailSuffix.length),
"string.url": (url) => url,
default: "assert",
});
just unfortunate part is i can't embed my constant value, so if it changes i don't get that for free here
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
can you do a suffix/prefix match without doing regex?
const ImageSource = match({
"string.url'=s96-c'": (url) =>
url.slice(0, url.length - constants.googleThumbnailSuffix.length),
"string.url": (url) => url,
default: "assert",
});
const ImageSource = match({
"string.url'=s96-c'": (url) =>
url.slice(0, url.length - constants.googleThumbnailSuffix.length),
"string.url": (url) => url,
default: "assert",
});
this doesn't work for the first key. basically trying to do like ['string${variableDefinedOutsideOfStringLiteral}']: url => slice(...) where inside the [], is backticks. was able to get it done with union and regex, but wondering the most "arktype-y" way to do it
57 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
update: i think batch is what i was looking for
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
or at least as far as I can tell
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
There's no suspense boundary, but none of the signals i'm accessing are async (ie. createResource/createAsync)
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
here's my whole component, maybe i'm messing up the conditional rendering in some way?
export default function JoinGroupPage() {
const session = useUser();
const z = useZero();
const navigate = useNavigate();
const params = useParams<Params>();

const group = useQuery(() =>
getTopLevelGroupDetailsByInviteLink(z, params.invitationId),
);

const guardedGroupWithMembers = useQuery(() =>
getGroupMembersWhereUserIsAMember(
z,
group()?.id ?? '',
session.user()?.id ?? '',
),
);

const isMember = () => guardedGroupWithMembers() !== undefined;

const handleJoinGroup = () => {
const g = group();
const user = session.user();
if (!g || !user || !user.username || isMember()) return;

// TODO: fix new state flash
void joinGroup(z, group()?.id ?? '', user.id, user.username);
navigate(`/group/${g.id}`);
};

return (
<Show when={session.user() && group()}>
{(group) => (
...
<StyledCard class="max-w-md w-full">
<StyledCardHeader>
<StyledCardTitle>
<Show when={!isMember()} fallback={"Can't join "}>
Join{' '}
</Show>
'{group().title}'
</StyledCardTitle>
<StyledCardDescription>
<Show
when={!isMember()}
fallback={"you're already a member of"}
>
you&apos;ve been invited to join
</Show>{' '}
'{group().title}'
</StyledCardDescription>
</StyledCardHeader>
<StyledCardContent class="flex justify-center">...</StyledCardContent>
</StyledCard>
)}
</Show>
);
}
export default function JoinGroupPage() {
const session = useUser();
const z = useZero();
const navigate = useNavigate();
const params = useParams<Params>();

const group = useQuery(() =>
getTopLevelGroupDetailsByInviteLink(z, params.invitationId),
);

const guardedGroupWithMembers = useQuery(() =>
getGroupMembersWhereUserIsAMember(
z,
group()?.id ?? '',
session.user()?.id ?? '',
),
);

const isMember = () => guardedGroupWithMembers() !== undefined;

const handleJoinGroup = () => {
const g = group();
const user = session.user();
if (!g || !user || !user.username || isMember()) return;

// TODO: fix new state flash
void joinGroup(z, group()?.id ?? '', user.id, user.username);
navigate(`/group/${g.id}`);
};

return (
<Show when={session.user() && group()}>
{(group) => (
...
<StyledCard class="max-w-md w-full">
<StyledCardHeader>
<StyledCardTitle>
<Show when={!isMember()} fallback={"Can't join "}>
Join{' '}
</Show>
'{group().title}'
</StyledCardTitle>
<StyledCardDescription>
<Show
when={!isMember()}
fallback={"you're already a member of"}
>
you&apos;ve been invited to join
</Show>{' '}
'{group().title}'
</StyledCardDescription>
</StyledCardHeader>
<StyledCardContent class="flex justify-center">...</StyledCardContent>
</StyledCard>
)}
</Show>
);
}
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
in that the nav happens before the next frame, so i'm not sure i'll have to look into my code a little more
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
yea there's something weird on my end going on. the minimal-ish repro i could make it only happens if i wrap the navigate in a setTimeout
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
might be tough in playground, working on a repro rn though
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
45 replies
SSolidJS
Created by jack on 12/24/2024 in #support
invoke navigate() after function call but before signal update propagates to ui
the signal that updates as a result of joinGroup is a memo
45 replies