Refactor ObjectSelect component to improve ID comparison and ensure case-insensitive matching. Update value and key properties to use lowercase string representation of object IDs for consistent handling.
This commit is contained in:
parent
8dc74f1a8e
commit
938bea5342
@ -217,7 +217,14 @@ const ObjectSelect = ({
|
|||||||
if (pIdx >= properties.length) {
|
if (pIdx >= properties.length) {
|
||||||
return data.map((object) => {
|
return data.map((object) => {
|
||||||
setObjectList((prev) => {
|
setObjectList((prev) => {
|
||||||
if (prev.some((p) => p._id === object._id)) return prev
|
if (
|
||||||
|
prev.some(
|
||||||
|
(p) =>
|
||||||
|
p._id.toString().toLowerCase() ===
|
||||||
|
object._id.toString().toLowerCase()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return prev
|
||||||
return [...prev, object]
|
return [...prev, object]
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
@ -235,8 +242,8 @@ const ObjectSelect = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
value: object._id,
|
value: object._id.toString().toLowerCase(),
|
||||||
key: object._id,
|
key: object._id.toString().toLowerCase(),
|
||||||
isLeaf: true,
|
isLeaf: true,
|
||||||
parentKeys,
|
parentKeys,
|
||||||
filterPath
|
filterPath
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user