mchisolm0
mchisolm0
TTCTheo's Typesafe Cult
Created by mchisolm0 on 6/7/2024 in #questions
Mobx-state-tree action is undefined when passed to onPress
Okay, I’ve got it working. I needed to switch back to passing the player using player={player} and then set up the typing for the props using interface.
interface AddLifePointsButtonProps {
player: Player
}
interface RemoveLifePointsButtonProps {
player: Player
}

// TODO Finish making buttons with both +5/+1 and minus
const RemoveLifePointsButton: React.FC<RemoveLifePointsButtonProps> = ({player}) => {
return (
<>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.removeLifePoints(1)}
LeftAccessory={(props) => <Icon style={props.style} icon="caretLeft" />}
text={"-1"}
/>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.removeLifePoints(5)}
LeftAccessory={(props) => <Icon style={props.style} icon="caretLeft" />}
text={"-5"}
/>
</>
)
}

const AddLifePointsButton: React.FC<AddLifePointsButtonProps> = ({player}) => {
return (
<>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.addLifePoints(1)}
RightAccessory={(props) => <Icon style={props.style} icon="caretRight" />}
text={"+1.o"}
/>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.addLifePoints(5)}
RightAccessory={(props) => <Icon style={props.style} icon="caretRight" />}
text={"+5"}
/>
</>
)
}
interface AddLifePointsButtonProps {
player: Player
}
interface RemoveLifePointsButtonProps {
player: Player
}

// TODO Finish making buttons with both +5/+1 and minus
const RemoveLifePointsButton: React.FC<RemoveLifePointsButtonProps> = ({player}) => {
return (
<>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.removeLifePoints(1)}
LeftAccessory={(props) => <Icon style={props.style} icon="caretLeft" />}
text={"-1"}
/>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.removeLifePoints(5)}
LeftAccessory={(props) => <Icon style={props.style} icon="caretLeft" />}
text={"-5"}
/>
</>
)
}

const AddLifePointsButton: React.FC<AddLifePointsButtonProps> = ({player}) => {
return (
<>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.addLifePoints(1)}
RightAccessory={(props) => <Icon style={props.style} icon="caretRight" />}
text={"+1.o"}
/>
<Button
style={{ marginVertical: spacing.sm }}
onPress={() => player.addLifePoints(5)}
RightAccessory={(props) => <Icon style={props.style} icon="caretRight" />}
text={"+5"}
/>
</>
)
}
If someone is willing to help me understand why this is better or different than setting the type inside the component definition, I would appreciate it.
3 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 5/2/2024 in #questions
Global error when clicking on photo in Gallery Tutorial
So...I pushed some updates to production (basically just ignoring the errors and continuing with the tutorial), and now I'm no longer seeing the error. I did update some packages, so its possible that was the issue. When I finish the tutorial, I'll try to get Theo's repo running locally and see if I get the same problem I saw.
5 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 5/2/2024 in #questions
Global error when clicking on photo in Gallery Tutorial
For context, there error I am seeing on Sentry is e is not iterable.
5 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 5/2/2024 in #questions
Global error when clicking on photo in Gallery Tutorial
Okay...so that doesn't seem to have been the problem. Still seeing it in production and not locally.
5 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 5/2/2024 in #questions
Global error when clicking on photo in Gallery Tutorial
Okay, rewatching a few parts of the video, I think I found it. I wrapped the children and modal in the <SignedIn> component in the layout. Instead, I need to leave them and in the page.tsx file (the child that needs to check for auth( )), I should wrap its content in the <SignedIn> component. Feel free to correct me, but I'm about to go try that change.
5 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 4/26/2024 in #questions
TypeErrorinitialTree is not iterable in Modern React Tutorial vid
That works. Thank you so much!
6 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 4/26/2024 in #questions
TypeErrorinitialTree is not iterable in Modern React Tutorial vid
I'm not sure where I can mark this as resolved, though.
6 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 4/26/2024 in #questions
TypeErrorinitialTree is not iterable in Modern React Tutorial vid
I figured it out now. I misunderstood the folder structure. Correct: app/@modal/(.)img/[id]/ My error was thinking the (.) was another layer of the directory making it app/@modal/(.)/img/[id].
6 replies
TTCTheo's Typesafe Cult
Created by nvk on 4/18/2024 in #questions
How to upgrade pnpm version of project
Searching: “mac pnpm homebrew revert to previous version” gave me this stack overflow. https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula
12 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 4/18/2024 in #questions
Clerk middleware complaining on new T3 gallery tutorial
Sounds good. Just wanted to document in case someone else had the problem.
8 replies
TTCTheo's Typesafe Cult
Created by nvk on 4/18/2024 in #questions
How to upgrade pnpm version of project
Did you try googling how to do it? I think it depends on if you are on Mac/Windows/Linux if you are saying change the version of pnpm. Is that what you were saying you changed the version of? What was the command you ran?
12 replies
TTCTheo's Typesafe Cult
Created by mchisolm0 on 4/18/2024 in #questions
Clerk middleware complaining on new T3 gallery tutorial
If anyone can verify for me, I'll mark this as resolved. I got it working by reverting Next to 14.2.1. Did I forget/overlook that somewhere?
8 replies