@webdevarif/dashui 0.2.4 → 0.2.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/dist/index.mjs CHANGED
@@ -1913,14 +1913,22 @@ function MediaPickerDialog({
1913
1913
  const fileInputRef = React20.useRef(null);
1914
1914
  const dragCounterRef = React20.useRef(0);
1915
1915
  React20.useEffect(() => {
1916
- if (open) {
1917
- setLocalSelected(new Set(initialSelected));
1918
- } else {
1916
+ if (!open) {
1919
1917
  setLocalSelected(/* @__PURE__ */ new Set());
1920
1918
  setIsDragging(false);
1921
1919
  dragCounterRef.current = 0;
1922
1920
  }
1923
1921
  }, [open]);
1922
+ const prevInitialRef = React20.useRef("");
1923
+ React20.useEffect(() => {
1924
+ if (!open) return;
1925
+ const key = initialSelected.join(",");
1926
+ if (key === prevInitialRef.current) return;
1927
+ prevInitialRef.current = key;
1928
+ if (initialSelected.length > 0) {
1929
+ setLocalSelected(new Set(initialSelected));
1930
+ }
1931
+ }, [open, initialSelected]);
1924
1932
  const handleDragEnter = (e) => {
1925
1933
  e.preventDefault();
1926
1934
  e.stopPropagation();