svelte-select-5 6.1.4 → 6.1.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/Select.svelte CHANGED
@@ -385,13 +385,18 @@
385
385
  if (!value || (multiple ? value.some((selection) => !selection || !selection[itemId]) : !value[itemId])) return;
386
386
 
387
387
  if (Array.isArray(value)) {
388
- // Only update if items actually changed
388
+ // Check if any value needs updating - compare properties, not references
389
+ // (Svelte 5 proxies have different identities than their targets)
389
390
  let needsUpdate = false;
390
391
  const newValue = value.map((selection) => {
391
392
  const found = findItem(selection);
392
- if (found && found !== selection) {
393
- needsUpdate = true;
394
- return found;
393
+ // Only update if found item has different properties (not just different reference)
394
+ if (found && found[itemId] === selection[itemId]) {
395
+ // Same itemId - check if other properties differ using JSON comparison
396
+ if (JSON.stringify(found) !== JSON.stringify(selection)) {
397
+ needsUpdate = true;
398
+ return found;
399
+ }
395
400
  }
396
401
  return selection;
397
402
  });
@@ -400,8 +405,11 @@
400
405
  }
401
406
  } else {
402
407
  const found = findItem();
403
- if (found && found !== value) {
404
- value = found;
408
+ // Only update if found item has different properties
409
+ if (found && found[itemId] === value[itemId]) {
410
+ if (JSON.stringify(found) !== JSON.stringify(value)) {
411
+ value = found;
412
+ }
405
413
  }
406
414
  }
407
415
  }
@@ -385,13 +385,18 @@
385
385
  if (!value || (multiple ? value.some((selection) => !selection || !selection[itemId]) : !value[itemId])) return;
386
386
 
387
387
  if (Array.isArray(value)) {
388
- // Only update if items actually changed
388
+ // Check if any value needs updating - compare properties, not references
389
+ // (Svelte 5 proxies have different identities than their targets)
389
390
  let needsUpdate = false;
390
391
  const newValue = value.map((selection) => {
391
392
  const found = findItem(selection);
392
- if (found && found !== selection) {
393
- needsUpdate = true;
394
- return found;
393
+ // Only update if found item has different properties (not just different reference)
394
+ if (found && found[itemId] === selection[itemId]) {
395
+ // Same itemId - check if other properties differ using JSON comparison
396
+ if (JSON.stringify(found) !== JSON.stringify(selection)) {
397
+ needsUpdate = true;
398
+ return found;
399
+ }
395
400
  }
396
401
  return selection;
397
402
  });
@@ -400,8 +405,11 @@
400
405
  }
401
406
  } else {
402
407
  const found = findItem();
403
- if (found && found !== value) {
404
- value = found;
408
+ // Only update if found item has different properties
409
+ if (found && found[itemId] === value[itemId]) {
410
+ if (JSON.stringify(found) !== JSON.stringify(value)) {
411
+ value = found;
412
+ }
405
413
  }
406
414
  }
407
415
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-select-5",
3
- "version": "6.1.4",
3
+ "version": "6.1.5",
4
4
  "description": "A <Select> component for Svelte 5 apps (fork of svelte-select)",
5
5
  "repository": "https://github.com/Dbone29/svelte-select-5.git",
6
6
  "author": "Robert Balfré <rob.balfre@gmail.com> (https://github.com/rob-balfre)",