@tinacms/app 0.0.0-20230516185052 → 0.0.0-20230516194926

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/CHANGELOG.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # @tinacms/app
2
2
 
3
- ## 0.0.0-20230516185052
3
+ ## 0.0.0-20230516194926
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - 7f95c1ce5: Reorganize the way fields are presented on the form to allow for deep-linking
8
8
  - Updated dependencies [b3d98d159]
9
9
  - Updated dependencies [7f95c1ce5]
10
- - @tinacms/toolkit@0.0.0-20230516185052
11
- - tinacms@0.0.0-20230516185052
10
+ - @tinacms/toolkit@0.0.0-20230516194926
11
+ - tinacms@0.0.0-20230516194926
12
12
 
13
13
  ## 1.2.12
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "0.0.0-20230516185052",
3
+ "version": "0.0.0-20230516194926",
4
4
  "main": "src/main.tsx",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
@@ -28,7 +28,7 @@
28
28
  "typescript": "^4.6.4",
29
29
  "zod": "^3.14.3",
30
30
  "@tinacms/mdx": "1.3.10",
31
- "@tinacms/toolkit": "0.0.0-20230516185052",
32
- "tinacms": "0.0.0-20230516185052"
31
+ "@tinacms/toolkit": "0.0.0-20230516194926",
32
+ "tinacms": "0.0.0-20230516194926"
33
33
  }
34
34
  }
@@ -179,11 +179,6 @@ export const useGraphQLReducer = (
179
179
  >([])
180
180
  const [operationIndex, setOperationIndex] = React.useState(0)
181
181
 
182
- const helper = React.useMemo(() => {
183
- const previewPlugins = cms.plugins.getType('preview-helper')
184
- return previewPlugins.find('preview-helper')
185
- }, [cms])
186
-
187
182
  React.useEffect(() => {
188
183
  const run = async () => {
189
184
  return Promise.all(
@@ -412,14 +407,6 @@ export const useGraphQLReducer = (
412
407
  )
413
408
  }
414
409
  }
415
- if (typeof value === 'string' && source?._tina_metadata) {
416
- // FIXME: hack to prevent breaking images
417
- if (helper) {
418
- const pathArray = G.responsePathAsArray(info.path)
419
-
420
- return helper.encode(pathArray.join('.'), value, payload.id)
421
- }
422
- }
423
410
  return value
424
411
  },
425
412
  })
@@ -444,7 +431,7 @@ export const useGraphQLReducer = (
444
431
  } else {
445
432
  if (result.data) {
446
433
  setResults((results) => [
447
- ...results,
434
+ ...results.filter((result) => result.id !== payload.id),
448
435
  { id: payload.id, data: result.data },
449
436
  ])
450
437
  }
@@ -494,6 +481,10 @@ export const useGraphQLReducer = (
494
481
  type: 'set-quick-editing-supported',
495
482
  value: event.data.value,
496
483
  })
484
+ iframe.current?.contentWindow?.postMessage({
485
+ type: 'quickEditEnabled',
486
+ value: cms.state.sidebarDisplayState === 'open',
487
+ })
497
488
  }
498
489
  if (event?.data?.type === 'isEditMode') {
499
490
  iframe?.current?.contentWindow?.postMessage({
@@ -503,6 +494,7 @@ export const useGraphQLReducer = (
503
494
  if (event.data.type === 'field:selected') {
504
495
  const [queryId, eventFieldName] = event.data.fieldName.split('---')
505
496
  const result = results.find((res) => res.id === queryId)
497
+ console.log(results)
506
498
  if (result?.data) {
507
499
  cms.dispatch({
508
500
  type: 'forms:set-active-field-name',
@@ -564,9 +556,9 @@ export const useGraphQLReducer = (
564
556
  React.useEffect(() => {
565
557
  iframe.current?.contentWindow?.postMessage({
566
558
  type: 'quickEditEnabled',
567
- value: cms.state.quickEditEnabled,
559
+ value: cms.state.sidebarDisplayState === 'open',
568
560
  })
569
- }, [cms.state.quickEditEnabled])
561
+ }, [cms.state.sidebarDisplayState])
570
562
 
571
563
  React.useEffect(() => {
572
564
  cms.dispatch({ type: 'set-edit-mode', value: 'visual' })
package/src/lib/util.ts CHANGED
@@ -113,7 +113,12 @@ export const getFormAndFieldNameFromMetadata = (
113
113
  ? fieldName.slice(value?.name?.length + 1)
114
114
  : fieldName
115
115
  if (localFieldName) {
116
- n = value.fields[localFieldName]
116
+ // If localFieldName is tags.2, just use `tags`
117
+ if (!isNaN(Number(localFieldName.split('.')[1]))) {
118
+ n = value.fields[localFieldName.split('.')[0]]
119
+ } else {
120
+ n = value.fields[localFieldName]
121
+ }
117
122
  } else {
118
123
  n = value.name
119
124
  }