File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export function Retros({ userId }: RetrosProps) {
21
21
const { toast } = useToast ( )
22
22
const [ isLimitReached , setIsLimitReached ] = useState ( false )
23
23
const { data : user } = api . user . getLoggedIn . useQuery ( )
24
- const accountType = getAccountType ( user ?. stripeSubscriptionStatus || null ) || AccountType . Standard
24
+ const accountType = getAccountType ( user ?. stripeSubscriptionStatus || null )
25
25
26
26
const {
27
27
data : retrospectives ,
@@ -57,7 +57,10 @@ export function Retros({ userId }: RetrosProps) {
57
57
}
58
58
59
59
useEffect ( ( ) => {
60
- if ( retrospectives && retrospectives . length >= 3 && accountType === AccountType . Standard ) {
60
+ if ( ! retrospectives ) return
61
+ if ( ! accountType ) return
62
+
63
+ if ( retrospectives . length >= 3 && accountType === AccountType . Standard ) {
61
64
setIsLimitReached ( true )
62
65
}
63
66
} , [ retrospectives , accountType ] )
@@ -67,9 +70,11 @@ export function Retros({ userId }: RetrosProps) {
67
70
< div className = 'flex flex-row items-baseline justify-between' >
68
71
< CardTitle className = 'p-5 text-center' > RETROS</ CardTitle >
69
72
70
- < div className = 'flex w-full justify-end' >
71
- < AddRetro handleAddRetro = { handleAddRetro } isLimitReached = { isLimitReached } />
72
- </ div >
73
+ { ! isLoading && (
74
+ < div className = 'flex w-full justify-end' >
75
+ < AddRetro handleAddRetro = { handleAddRetro } isLimitReached = { isLimitReached } />
76
+ </ div >
77
+ ) }
73
78
</ div >
74
79
75
80
{ isLoading && < Loader isLoading = { isLoading } /> }
You can’t perform that action at this time.
0 commit comments