@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.js CHANGED
@@ -2049,14 +2049,22 @@ function MediaPickerDialog({
2049
2049
  const fileInputRef = React20.useRef(null);
2050
2050
  const dragCounterRef = React20.useRef(0);
2051
2051
  React20.useEffect(() => {
2052
- if (open) {
2053
- setLocalSelected(new Set(initialSelected));
2054
- } else {
2052
+ if (!open) {
2055
2053
  setLocalSelected(/* @__PURE__ */ new Set());
2056
2054
  setIsDragging(false);
2057
2055
  dragCounterRef.current = 0;
2058
2056
  }
2059
2057
  }, [open]);
2058
+ const prevInitialRef = React20.useRef("");
2059
+ React20.useEffect(() => {
2060
+ if (!open) return;
2061
+ const key = initialSelected.join(",");
2062
+ if (key === prevInitialRef.current) return;
2063
+ prevInitialRef.current = key;
2064
+ if (initialSelected.length > 0) {
2065
+ setLocalSelected(new Set(initialSelected));
2066
+ }
2067
+ }, [open, initialSelected]);
2060
2068
  const handleDragEnter = (e) => {
2061
2069
  e.preventDefault();
2062
2070
  e.stopPropagation();