dashboard fix: dont allow create until versions is populated

This commit is contained in:
Ben Allfree 2024-12-04 03:10:36 -08:00
parent 058be8344b
commit ea113a9cfe
2 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
'@pockethost/dashboard': patch
---
Dashboard fix: Don't allow instance creation until versions are available

View File

@ -1,11 +1,10 @@
<script lang="ts">
import {
globalInstancesStore,
isUserPaid,
userSubscriptionType,
versions,
} from '$util/stores'
import { values } from '@s-libs/micro-dash'
import { SubscriptionType } from 'pockethost/common'
import Creator from './Creator.svelte'
import Paywall from './Paywall.svelte'
import { MAX_INSTANCE_COUNTS } from '$src/env'
@ -13,9 +12,10 @@
let instanceCount = 0
let canCreate = false
$: {
console.log(MAX_INSTANCE_COUNTS[$userSubscriptionType])
instanceCount = values($globalInstancesStore).length
canCreate = instanceCount < MAX_INSTANCE_COUNTS[$userSubscriptionType]
canCreate =
instanceCount < MAX_INSTANCE_COUNTS[$userSubscriptionType] &&
$versions.length > 0
}
</script>