Skip to content

Commit 69ec169

Browse files
committed
fix: adjust redux logic to prevent data mixing when changing pagination settings; resolves #54
1 parent d6855a3 commit 69ec169

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/redux/neurojson/neurojson.slice.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,6 @@ const neurojsonSlice = createSlice({
5858
state.hasMore =
5959
action.payload.offset + action.payload.rows.length <
6060
action.payload.total_rows;
61-
// Check if we received fewer items than the limit, indicating we've reached the end
62-
// console.log(action.payload.total_rows);
63-
// state.limit = action.payload.total_rows;
64-
// const reachedEnd = action.payload.offset + action.payload.rows.length >= action.payload.total_rows;
65-
66-
// Filter out duplicates while preserving order
67-
// const uniqueEntries = action.payload.rows.filter(
68-
// (newItem) =>
69-
// !state.data.some((existingItem) => existingItem.id === newItem.id)
70-
// );
71-
72-
// state.loading = false;
73-
74-
// if (uniqueEntries.length > 0) {
75-
// Append new unique entries to existing data
76-
// state.data = uniqueEntries; // ✅ Replace instead of append
77-
// state.offset = action.payload.offset; // ✅ Track current offset
78-
// Only set hasMore to true if we haven't reached the end
79-
// state.hasMore = !reachedEnd;
80-
// } else {
81-
// If no new unique entries were found, we've reached the end
82-
// state.hasMore = false;
83-
// }
8461
}
8562
)
8663
.addCase(loadPaginatedData.rejected, (state, action) => {

0 commit comments

Comments
 (0)