aport-tools 4.4.25 → 4.4.26

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.4.25 | ISC */
1
+ /*! aport-tools v4.4.26 | ISC */
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
@@ -1168,18 +1168,19 @@ var InputAttach = function InputAttach(_a) {
1168
1168
  var _g = useFormContext(),
1169
1169
  setFormValue = _g.setFormValue,
1170
1170
  formErrors = _g.errors;
1171
- // Initialize with firstValue or an empty array
1172
- var _h = React.useState(function () {
1173
- return Array.isArray(firstValue) ? firstValue.slice(0, amount) : [];
1174
- }),
1171
+ var _h = React.useState([]),
1175
1172
  selectedFiles = _h[0],
1176
1173
  setSelectedFiles = _h[1];
1177
- // Update the form context on mount with firstValue if provided
1174
+ // Ref to track initialization
1175
+ var isInitialized = React.useRef(false);
1176
+ // Sync firstValue with selectedFiles when it changes
1178
1177
  React.useEffect(function () {
1179
- if (firstValue.length > 0) {
1180
- setFormValue(name, firstValue.slice(0, amount));
1178
+ if (!isInitialized.current) {
1179
+ setSelectedFiles(firstValue);
1180
+ setFormValue(name, firstValue); // Update form context
1181
+ isInitialized.current = true;
1181
1182
  }
1182
- }, [firstValue, name, setFormValue, amount]);
1183
+ }, [firstValue, name, setFormValue]);
1183
1184
  var theme = React.useContext(aportThemes.ThemeContext).theme;
1184
1185
  var colors = theme.colors;
1185
1186
  var pickImage = function pickImage() {