Skip to content

Commit

Permalink
Merge pull request #54 from contentstack/fix/DX-1951
Browse files Browse the repository at this point in the history
fix: Non published references are returned by DataSync when using include([Array of refs]) function and the UIDs are mixed up
  • Loading branch information
aman19K authored Dec 23, 2024
2 parents 679cf86 + 18fa621 commit a9d46bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,11 @@ export class Stack {

for (let i = 0, j = oldShelf.length; i < j; i++) {
const element: IShelf = oldShelf[i]
// Adjust position if needed (e.g., if item was removed before the current position)
if (Number(element.position) >= element.path.length) {
element.position = (element.path.length - 1).toString(); // Ensure position is within bounds
}

let flag = true
for (let k = 0, l = result.docs.length; k < l; k++) {
if (result.docs[k].uid === element.uid) {
Expand Down Expand Up @@ -1755,7 +1760,7 @@ export class Stack {
oldEntryQueries = null

for (let i = oldObjectPointerList.length - 1, j = 0; i >= j; i--) {
const element: IShelf = oldObjectPointerList[i]
const element: IShelf = oldObjectPointerList[i]
let flag = true
for (let k = 0, l = result.docs.length; k < l; k++) {
if (result.docs[k].uid === element.uid) {
Expand Down

0 comments on commit a9d46bc

Please sign in to comment.