@truedat/df 8.8.7 → 8.8.8
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": "@truedat/df",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.8",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
52
|
"@testing-library/react": "^16.3.0",
|
|
53
53
|
"@testing-library/user-event": "^14.6.1",
|
|
54
|
-
"@truedat/test": "8.8.
|
|
54
|
+
"@truedat/test": "8.8.8",
|
|
55
55
|
"identity-obj-proxy": "^3.0.0",
|
|
56
56
|
"jest": "^29.7.0",
|
|
57
57
|
"redux-saga-test-plan": "^4.0.6"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@apollo/client": "^3.13.8",
|
|
61
|
-
"@truedat/core": "8.8.
|
|
61
|
+
"@truedat/core": "8.8.8",
|
|
62
62
|
"axios": "^1.15.0",
|
|
63
63
|
"graphql": "^16.11.0",
|
|
64
64
|
"is-hotkey": "^0.2.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
88
88
|
"swr": "^2.3.3"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "850b1a20250c39f4781aea0174aeebd383898eea"
|
|
91
91
|
}
|
|
@@ -25,6 +25,12 @@ export const DynamicForm = ({
|
|
|
25
25
|
const appliedKeyRef = useRef(null);
|
|
26
26
|
const latestContentRef = useRef(content);
|
|
27
27
|
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!_.isEqual(content, latestContentRef.current)) {
|
|
30
|
+
latestContentRef.current = content;
|
|
31
|
+
}
|
|
32
|
+
}, [content]);
|
|
33
|
+
|
|
28
34
|
useEffect(() => {
|
|
29
35
|
if (!_.isEmpty(template)) {
|
|
30
36
|
const templateId = template?.id || template?.name;
|
|
@@ -188,6 +188,70 @@ describe("<DynamicForm />", () => {
|
|
|
188
188
|
expect(rendered.container.querySelector(".field-group-segment")).toBeNull();
|
|
189
189
|
});
|
|
190
190
|
|
|
191
|
+
it("preserves externally applied content (e.g. AI suggestions) on later edits", async () => {
|
|
192
|
+
const applyTemplate = jest.fn((content) => content);
|
|
193
|
+
const onChange = jest.fn();
|
|
194
|
+
|
|
195
|
+
const template = {
|
|
196
|
+
scope: "bg",
|
|
197
|
+
content: [
|
|
198
|
+
{
|
|
199
|
+
name: "g1",
|
|
200
|
+
fields: [
|
|
201
|
+
{
|
|
202
|
+
name: "md-field",
|
|
203
|
+
label: "md-label",
|
|
204
|
+
type: "markdown",
|
|
205
|
+
widget: "markdown",
|
|
206
|
+
cardinality: "1",
|
|
207
|
+
},
|
|
208
|
+
{ name: "func", label: "func" },
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const rendered = render(
|
|
215
|
+
<DynamicForm
|
|
216
|
+
applyTemplate={applyTemplate}
|
|
217
|
+
content={{}}
|
|
218
|
+
onChange={onChange}
|
|
219
|
+
template={template}
|
|
220
|
+
/>,
|
|
221
|
+
);
|
|
222
|
+
await waitForLoad(rendered);
|
|
223
|
+
|
|
224
|
+
// Parent applies AI suggestions to both fields and re-renders the form.
|
|
225
|
+
const appliedContent = {
|
|
226
|
+
"md-field": { value: "enriched", origin: "ai" },
|
|
227
|
+
func: { value: "functional", origin: "ai" },
|
|
228
|
+
};
|
|
229
|
+
rendered.rerender(
|
|
230
|
+
<DynamicForm
|
|
231
|
+
applyTemplate={applyTemplate}
|
|
232
|
+
content={appliedContent}
|
|
233
|
+
onChange={onChange}
|
|
234
|
+
template={template}
|
|
235
|
+
/>,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
onChange.mockClear();
|
|
239
|
+
fireEvent.click(rendered.getByText(/edit markdown/i));
|
|
240
|
+
|
|
241
|
+
await waitFor(() => {
|
|
242
|
+
expect(onChange).toHaveBeenCalled();
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// The edit merges into the applied content, not a stale snapshot, so the
|
|
246
|
+
// other suggested field ("func") survives.
|
|
247
|
+
expect(onChange).toHaveBeenLastCalledWith(
|
|
248
|
+
expect.objectContaining({
|
|
249
|
+
func: { value: "functional", origin: "ai" },
|
|
250
|
+
"md-field": { value: "enriched updated", origin: "user" },
|
|
251
|
+
}),
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
191
255
|
it("sends updated markdown string to onChange payload", async () => {
|
|
192
256
|
const applyTemplate = jest.fn((content) => content);
|
|
193
257
|
const onChange = jest.fn();
|