Skip to content

Commit

Permalink
0.0.88
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansglazunov committed Sep 25, 2024
1 parent 7bd9172 commit e31dd39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion imports/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ export class DeepClient<L extends Link<Id> = Link<Id>> implements DeepClientInst
if (typeof(start) === 'object') {
return ((await this.select(start)) as any)?.data?.[0]?.id;
}
if (_ids?.[start]?.[path[0]]) {
if (path.length === 2 && _ids?.[start]?.[path[0]]) {
return _ids[start][path[0]];
}
const q = await this.select(pathToWhere(start, ...path));
Expand Down
4 changes: 2 additions & 2 deletions imports/minilinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export class MinilinkCollection<MGO extends MinilinksGeneratorOptions = typeof M
* ```
*/
id(start: DeepClientStartItem, ...path: DeepClientPathItem[]): Id {
const paths = [start, ...path] as [Id, ...Array<Exclude<Id, boolean>>];
const paths = [start, ...(path[path.length - 1] === true ? path.slice(0, -1) : path)] as [Id, ...Array<Exclude<Id, boolean>>];
// let result: number;
// if(paths.length === 1) {

Expand All @@ -397,7 +397,7 @@ export class MinilinkCollection<MGO extends MinilinksGeneratorOptions = typeof M
})
const result = (link as Link<Id>)?.id;

if(!result) {
if(!result && path[path.length - 1] !== true) {
const precached = get(_ids, paths.join('.'));
if (precached) return precached;
throw new Error(`Id not found by ${JSON.stringify([start, ...path])}`);
Expand Down

0 comments on commit e31dd39

Please sign in to comment.