@tinacms/app 2.5.3 → 2.5.5
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 +16 -0
- package/package.json +2 -2
- package/src/lib/expand-query.ts +22 -3
- package/src/lib/graphql-reducer.ts +1 -0
- package/src/lib/util.ts +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @tinacms/app
|
|
2
2
|
|
|
3
|
+
## 2.5.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6681](https://github.com/tinacms/tinacms/pull/6681) [`95b7523`](https://github.com/tinacms/tinacms/commit/95b75237cb91ec3dc5dac9ce52359f9786072502) Thanks [@isaaclombardssw](https://github.com/isaaclombardssw)! - Fix click-to-edit for fields in connection query results (e.g. ruleConnection)
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- tinacms@3.9.2
|
|
11
|
+
|
|
12
|
+
## 2.5.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`7b539b8`](https://github.com/tinacms/tinacms/commit/7b539b8e7d7d9f4451b5fd36a04d26b734f7d78e)]:
|
|
17
|
+
- tinacms@3.9.1
|
|
18
|
+
|
|
3
19
|
## 2.5.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/app",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
4
4
|
"main": "src/main.tsx",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"typescript": "^5.7.3",
|
|
28
28
|
"zod": "^3.24.2",
|
|
29
29
|
"@tinacms/mdx": "2.1.6",
|
|
30
|
-
"tinacms": "3.9.
|
|
30
|
+
"tinacms": "3.9.2"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"url": "https://github.com/tinacms/tinacms.git",
|
package/src/lib/expand-query.ts
CHANGED
|
@@ -3,14 +3,17 @@ import * as G from 'graphql';
|
|
|
3
3
|
export const expandQuery = ({
|
|
4
4
|
schema,
|
|
5
5
|
documentNode,
|
|
6
|
+
includeNodeMetadata,
|
|
6
7
|
}: {
|
|
7
8
|
schema: G.GraphQLSchema;
|
|
8
9
|
documentNode: G.DocumentNode;
|
|
10
|
+
includeNodeMetadata?: boolean;
|
|
9
11
|
}): G.DocumentNode => {
|
|
10
12
|
const documentNodeWithTypenames = addTypenameToDocument(documentNode);
|
|
11
13
|
return addMetaFieldsToQuery(
|
|
12
14
|
documentNodeWithTypenames,
|
|
13
|
-
new G.TypeInfo(schema)
|
|
15
|
+
new G.TypeInfo(schema),
|
|
16
|
+
includeNodeMetadata
|
|
14
17
|
);
|
|
15
18
|
};
|
|
16
19
|
|
|
@@ -114,7 +117,8 @@ const addMetadataField = (
|
|
|
114
117
|
|
|
115
118
|
const addMetaFieldsToQuery = (
|
|
116
119
|
documentNode: G.DocumentNode,
|
|
117
|
-
typeInfo: G.TypeInfo
|
|
120
|
+
typeInfo: G.TypeInfo,
|
|
121
|
+
includeNodeMetadata?: boolean
|
|
118
122
|
) => {
|
|
119
123
|
const addMetaFields: G.VisitFn<G.ASTNode, G.FieldNode> = (
|
|
120
124
|
node: G.FieldNode
|
|
@@ -126,7 +130,11 @@ const addMetaFieldsToQuery = (
|
|
|
126
130
|
kind: 'SelectionSet',
|
|
127
131
|
selections: [],
|
|
128
132
|
}),
|
|
129
|
-
selections: [
|
|
133
|
+
selections: [
|
|
134
|
+
...(node.selectionSet?.selections || []),
|
|
135
|
+
...metaFields,
|
|
136
|
+
...(includeNodeMetadata ? nodeMetadataFields : []),
|
|
137
|
+
],
|
|
130
138
|
},
|
|
131
139
|
};
|
|
132
140
|
};
|
|
@@ -218,6 +226,17 @@ const metaFields: G.SelectionNode[] =
|
|
|
218
226
|
// @ts-ignore
|
|
219
227
|
node.definitions[0].selectionSet.selections;
|
|
220
228
|
|
|
229
|
+
const nodeMetadataFragment = G.parse(`
|
|
230
|
+
query Sample {
|
|
231
|
+
...on Document {
|
|
232
|
+
_tina_metadata
|
|
233
|
+
_content_source
|
|
234
|
+
}
|
|
235
|
+
}`);
|
|
236
|
+
const nodeMetadataFields: G.SelectionNode[] =
|
|
237
|
+
// @ts-ignore
|
|
238
|
+
nodeMetadataFragment.definitions[0].selectionSet.selections;
|
|
239
|
+
|
|
221
240
|
export const isNodeType = (type: G.GraphQLOutputType) => {
|
|
222
241
|
const namedType = G.getNamedType(type);
|
|
223
242
|
if (G.isInterfaceType(namedType)) {
|
|
@@ -942,6 +942,7 @@ const expandPayload = async (
|
|
|
942
942
|
const expandedDocumentNodeForResolver = expandQuery({
|
|
943
943
|
schema: schemaForResolver,
|
|
944
944
|
documentNode,
|
|
945
|
+
includeNodeMetadata: true,
|
|
945
946
|
});
|
|
946
947
|
const expandedQueryForResolver = G.print(expandedDocumentNodeForResolver);
|
|
947
948
|
return { ...payload, expandedQuery, expandedData, expandedQueryForResolver };
|
package/src/lib/util.ts
CHANGED
|
@@ -93,9 +93,10 @@ export const getDeepestMetadata = (state: Object, complexKey: string): any => {
|
|
|
93
93
|
}
|
|
94
94
|
const value = current[key];
|
|
95
95
|
if (value?._tina_metadata) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (complexKey === value._tina_metadata?.prefix && metadata) {
|
|
96
|
+
if (value._tina_metadata.id === null) {
|
|
97
|
+
// Placeholder metadata from connection/list types — skip it
|
|
98
|
+
} else if (complexKey === value._tina_metadata?.prefix && metadata) {
|
|
99
|
+
// Reference field — keep the parent form's metadata
|
|
99
100
|
} else {
|
|
100
101
|
metadata = value._tina_metadata;
|
|
101
102
|
}
|