@visualizevalue/mint-app-base 0.1.118 → 0.1.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,9 +74,7 @@ const { token } = defineProps<{
74
74
  const store = useOnchainStore()
75
75
  const collection = computed(() => store.collection(token.collection))
76
76
 
77
- const { defaultAmount, step } = useMintDefault()
78
- const mintCount = ref(String(defaultAmount.value))
79
- watch(defaultAmount, (v) => { mintCount.value = String(v) })
77
+ const { defaultAmount, mintCount, step } = useMintDefault()
80
78
  const ownedBalance = computed(
81
79
  () => collection.value && store.tokenBalance(collection.value.address, token.tokenId),
82
80
  )
@@ -376,6 +376,11 @@ export const useOnchainStore = () => {
376
376
  }
377
377
 
378
378
  this.collections[address].tokens[`${token.tokenId}`] = token
379
+
380
+ // Update latestTokenId if this token is newer than what's cached
381
+ if (tokenId > this.collections[address].latestTokenId) {
382
+ this.collections[address].latestTokenId = tokenId
383
+ }
379
384
  } catch (e) {
380
385
  // Retry 3 times
381
386
  if (tries < 3) {
@@ -25,5 +25,10 @@ export const useMintDefault = () => {
25
25
  return Math.max(1, Number(targetCents / unitPriceCents))
26
26
  })
27
27
 
28
- return { defaultAmount, step }
28
+ // Persist across navigations so the value survives remounts
29
+ const mintCount = useState('mint-count', () => String(defaultAmount.value))
30
+
31
+ watch(defaultAmount, (v) => { mintCount.value = String(v) })
32
+
33
+ return { defaultAmount, mintCount, step }
29
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visualizevalue/mint-app-base",
3
- "version": "0.1.118",
3
+ "version": "0.1.119",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "dependencies": {
@@ -25,14 +25,7 @@ const maybeCheckBalance = async (force = false) => {
25
25
  }
26
26
  watch(isConnected, () => maybeCheckBalance(true))
27
27
 
28
- // Navigation guards
29
28
  onMounted(async () => {
30
- if (collection.value.latestTokenId < tokenId.value) {
31
- return navigateTo({ name: 'id-collection', params: { id: id.value, collection: collection.value.address }}, {
32
- replace: true
33
- })
34
- }
35
-
36
29
  await maybeCheckBalance()
37
30
  })
38
31
 
@@ -22,6 +22,10 @@ const load = async () => {
22
22
  return navigateTo({ name: 'id-collection' }, { replace: true })
23
23
  }
24
24
 
25
+ if (!token.value) {
26
+ return navigateTo({ name: 'id-collection' }, { replace: true })
27
+ }
28
+
25
29
  loading.value = false
26
30
  }
27
31