@digi-frontend/dgate-api-documentation 1.0.15 → 1.0.16

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": "@digi-frontend/dgate-api-documentation",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "main": "dist/src/index.js",
5
5
  "module": "dist/src/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -44,7 +44,7 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
44
44
  setTableRecords(generateTableData(values.tags))
45
45
  setTableData(values.tags)
46
46
  }
47
- }, [])
47
+ }, [values.tags])
48
48
 
49
49
  const confirmDeleteTag = () => {
50
50
  if (selectedTagIndex !== null) {
@@ -77,7 +77,8 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
77
77
 
78
78
  const saveNewRow = (tag) => {
79
79
  setTableData([...tableData, tag])
80
- setFieldValue(`tags`, [...values.tags, tag])
80
+ const oldTags = values.tags || [];
81
+ setFieldValue(`tags`, [...oldTags, tag])
81
82
  }
82
83
 
83
84
  const handleDeleteClick = (id: number, name: string) => {
@@ -29,7 +29,7 @@ const LivePreview: React.FC<LivePreviewProps> = ({ transformedData }) => {
29
29
  : null
30
30
 
31
31
  useEffect(() => {
32
- if (values.tags && values.tags.length) {
32
+ if (values.tags) {
33
33
  setTableRecords(generateTableData(values.tags, true))
34
34
  setTableData(values.tags)
35
35
  }
@@ -69,8 +69,8 @@ const LivePreview: React.FC<LivePreviewProps> = ({ transformedData }) => {
69
69
  </a>
70
70
  ) : (
71
71
  <Button className={styles.editDescBtn} variant="link" color="action">
72
- {item.description ? item.description.substring(0, 12) : '-'}
73
- {item.description && item.description.length > 12 ? '...' : ''}
72
+ {item.externalDocs?.description ? item.externalDocs?.description.substring(0, 12) : '-'}
73
+ {item.externalDocs?.description && item.externalDocs?.description.length > 12 ? '...' : ''}
74
74
  </Button>
75
75
  )}
76
76
 
@@ -30,12 +30,12 @@ const TagsTable = ({ id, headCells, data, isFormOpen, setIsFormOpen, saveNewRow,
30
30
  externalDocs: yup.object().optional(),
31
31
  }),
32
32
  onSubmit: (values) => {
33
+ saveNewRow(values)
33
34
  setText('')
34
35
  setExternalDesc('')
35
36
  setExternalUrl('')
36
37
  resetForm()
37
38
  setIsFormOpen(false)
38
- saveNewRow(values)
39
39
  },
40
40
  })
41
41
  return (