@integry/sdk 4.6.94 → 4.6.95

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": "@integry/sdk",
3
- "version": "4.6.94",
3
+ "version": "4.6.95",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -5,7 +5,6 @@ import { TemplateField, NestedObject } from '@/interfaces';
5
5
  import AppContext from '@/contexts/AppContext';
6
6
  import { StoreType } from '@/types/store';
7
7
  // import { Input } from '@/components/Input';
8
- import { LargeLoader } from '@/components/LargeLoader';
9
8
  import { Loader } from '@/components/Loader';
10
9
  import { MultipurposeField } from '@/components/MultipurposeField';
11
10
  import { actionFunctions } from '@/store';
@@ -141,7 +140,13 @@ const DynamicFields = (props: DynamicFieldsProps) => {
141
140
 
142
141
  useEffect(() => {
143
142
  fetchDynamicFields();
144
- }, [dynamicField, endpointData, selectedAuthId, parentFieldChanged]);
143
+ }, [parentFieldChanged]);
144
+
145
+ useEffect(() => {
146
+ if (!onChangeCallback) {
147
+ fetchDynamicFields();
148
+ }
149
+ }, [dynamicField, endpointData, selectedAuthId]);
145
150
 
146
151
  const getPlaceholder = () => {
147
152
  let placeHolderValue = 'Enter text or map to fields...';
@@ -166,13 +171,19 @@ const DynamicFields = (props: DynamicFieldsProps) => {
166
171
  });
167
172
 
168
173
  if (onChangeCallback && objectValue !== null) {
169
- const data = {
170
- ...customFieldsData,
171
- [machineName]: val,
172
- };
173
- setCustomFieldsData(data);
174
+ // Use the functional update form of setState to ensure we're working with the latest state
175
+ setCustomFieldsData((prevData: any) => {
176
+ const updatedData = {
177
+ ...prevData,
178
+ [machineName]: val,
179
+ };
174
180
 
175
- onChangeCallback(JSON.stringify(data));
181
+ // Call the callback with the updated data
182
+ onChangeCallback(JSON.stringify(updatedData));
183
+
184
+ // Return the updated data to set the state
185
+ return updatedData;
186
+ });
176
187
  } else {
177
188
  props.setStepMappingData({
178
189
  stepId,