@stonecrop/desktop 0.12.1 → 0.12.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/desktop",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -32,11 +32,11 @@
32
32
  "**/*.css"
33
33
  ],
34
34
  "dependencies": {
35
- "@stonecrop/aform": "0.12.1",
36
- "@stonecrop/themes": "0.12.1",
37
- "@stonecrop/stonecrop": "0.12.1",
38
- "@stonecrop/schema": "0.12.1",
39
- "@stonecrop/atable": "0.12.1"
35
+ "@stonecrop/schema": "0.12.3",
36
+ "@stonecrop/atable": "0.12.3",
37
+ "@stonecrop/stonecrop": "0.12.3",
38
+ "@stonecrop/themes": "0.12.3",
39
+ "@stonecrop/aform": "0.12.3"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "vue": "^3.5.33"
@@ -678,23 +678,24 @@ const handleClick = async (event: Event) => {
678
678
  }
679
679
  }
680
680
 
681
- const loadRecordData = () => {
682
- if (!stonecrop.value || !currentDoctype.value) return
681
+ const loadRecordData = async () => {
682
+ if (!stonecrop.value || !currentDoctype.value || isNewRecord.value) return
683
683
 
684
- loading.value = true
684
+ // Record already in HST — nothing to fetch.
685
+ if (stonecrop.value.getRecordById(currentDoctype.value, currentRecordId.value)) return
685
686
 
686
- try {
687
- if (!isNewRecord.value) {
688
- // For existing records, ensure the record exists in HST.
689
- // The computed currentViewData will automatically read from HST.
690
- stonecrop.value.getRecordById(currentDoctype.value, currentRecordId.value)
687
+ // Record absent and a client is configured — fetch directly so the form
688
+ // populates even when the list view was never visited (direct URL navigation).
689
+ if (stonecrop.value.getClient()) {
690
+ loading.value = true
691
+ try {
692
+ await stonecrop.value.getRecord(currentDoctype.value, currentRecordId.value)
693
+ } catch (error) {
694
+ // eslint-disable-next-line no-console
695
+ console.warn('Error fetching record:', error)
696
+ } finally {
697
+ loading.value = false
691
698
  }
692
- // For new records, currentViewData computed property will return {} automatically.
693
- } catch (error) {
694
- // eslint-disable-next-line no-console
695
- console.warn('Error loading record data:', error)
696
- } finally {
697
- loading.value = false
698
699
  }
699
700
  }
700
701
 
@@ -708,7 +709,7 @@ watch(
708
709
  } else if (currentView.value === 'record' && currentDoctype.value && currentRecordId.value) {
709
710
  // Emit load-record event so host app can fetch and populate HST
710
711
  emit('load-record', { doctype: currentDoctype.value, recordId: currentRecordId.value })
711
- loadRecordData()
712
+ void loadRecordData()
712
713
  }
713
714
  },
714
715
  { immediate: true }