Skip to content

Commit

Permalink
Updated ImportJsonTask file mapDocuments method to use unshift instea…
Browse files Browse the repository at this point in the history
…d of push for sorting order (#8183)
  • Loading branch information
PrasadBandaru473 authored Jan 2, 2025
1 parent d645915 commit 9cab404
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/queues/tasks/ImportJSONTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export default class ImportJSONTask extends ImportTask {
) {
Object.values(documents).forEach((node) => {
const id = uuidv4();
output.documents.push({
// Using unshift instead of push to maintain the correct order of documents
// because addDocumentToStructure uses index 0 for insertion, reversing the order
output.documents.unshift({
...node,
path: "",
// populate text to maintain consistency with existing data.
Expand Down

0 comments on commit 9cab404

Please sign in to comment.