Skip to content

Commit

Permalink
0.0.399
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansglazunov committed Jul 20, 2024
1 parent 8669539 commit 63252f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions imports/minilinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class MinilinkCollection<MGO extends MinilinksGeneratorOptions = typeof M
prev = data;
observer.next(data);
}
}, 50);
}, 300);
};
ml.emitter.on('added', listener);
ml.emitter.on('updated', listener);
Expand Down Expand Up @@ -770,13 +770,19 @@ export class MinilinkCollection<MGO extends MinilinksGeneratorOptions = typeof M
// find virtual
let old = byId[link.id];
const virtualIds = Object.keys(this.virtual);
const [virtual] = this.query({
id: { _in: virtualIds.map(i => Number(i)) },
...(link.type_id ? { _type_id: link.type_id } : {}),
...(link.from_id ? { _from_id: link.from_id } : {}),
...(link.to_id ? { _to_id: link.to_id } : {}),
...(link.value ? { value: link.value } : {}),
});
let virtual;
for (let i = 0; i < virtualIds.length; i++) {
const v = this.byId[virtualIds[i]];
if (
(!link.type_id || link.type_id == v._type_id) &&
(!link.from_id || link.from_id == v._from_id) &&
(!link.to_id || link.to_id == v._to_id) &&
(!link.value || _isEqual(link.value, v.value))
) {
virtual = v;
break;
}
}
if (virtual) {
if (old) throw new Error(`somehow we have oldLink.id ${old.id} and virtualLink.id ${virtual.id} virtualLink._id = ${virtual._id}`);
old = virtual;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deep-foundation/deeplinks",
"version": "0.0.388",
"version": "0.0.389",
"license": "Unlicense",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 63252f9

Please sign in to comment.