Skip to content

Commit fc83773

Browse files
authored
Merge pull request #458 from p-wieser/v3
Make sure getInfo publication return each id only once
2 parents 3d445fe + 6fd7e3a commit fc83773

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/main.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ Meteor.publish('tabular_getInfo', async function (tableName, selector, sort, ski
163163
// From https://datatables.net/manual/server-side
164164
// recordsTotal: Total records, before filtering (i.e. the total number of records in the database)
165165
// recordsFiltered: Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned for this page of data).
166+
// happens that this first getInfo publication may return duplicate ids
167+
// and this explain the lack of reactivity on changes that some have reported (because the second publication only returns once when first has asked twice)
168+
// so https://stackoverflow.com/questions/9229645/remove-duplicate-values-from-js-array
166169

167170
const record = {
168-
ids: filteredRecordIds,
171+
ids: [ ...new Set( filteredRecordIds )],
169172
// count() will give us the updated total count
170173
// every time. It does not take the find options
171174
// limit into account.

0 commit comments

Comments
 (0)