@@ -16,7 +16,7 @@ class CoCreateServerSideRender {
16
16
async function render ( html , lastKey ) {
17
17
const dom = parse ( html ) ;
18
18
for ( let el of dom . querySelectorAll (
19
- "[collection ][name][document_id ]"
19
+ "[array ][name][object ]"
20
20
) ) {
21
21
let meta = el . attributes ;
22
22
@@ -34,33 +34,34 @@ class CoCreateServerSideRender {
34
34
35
35
if ( el . hasAttribute ( 'actions' ) )
36
36
continue ;
37
- let _id = meta [ "document_id " ] ,
38
- collection = meta [ 'collection ' ] ,
37
+ let _id = meta [ "object " ] ,
38
+ array = meta [ 'array ' ] ,
39
39
name = meta [ 'name' ] ;
40
- let key = _id + collection + name ;
41
- if ( ! _id || ! name || ! collection ) continue ;
42
- if ( ! checkValue ( _id ) || ! checkValue ( name ) || ! checkValue ( collection ) ) continue ;
40
+ let key = _id + array + name ;
41
+ if ( ! _id || ! name || ! array ) continue ;
42
+ if ( ! checkValue ( _id ) || ! checkValue ( name ) || ! checkValue ( array ) ) continue ;
43
43
if ( dep . includes ( key ) )
44
44
throw new Error (
45
- `infinite loop: ${ lastKey } ${ collection } ${ name } ${ _id } has been already rendered`
45
+ `infinite loop: ${ lastKey } ${ array } ${ name } ${ _id } has been already rendered`
46
46
) ;
47
47
else
48
48
dep . push ( key )
49
49
50
- let cacheKey = _id + collection ;
50
+ let cacheKey = _id + array ;
51
51
let record ;
52
52
if ( dbCache . has ( cacheKey ) )
53
53
record = dbCache . get ( cacheKey )
54
54
else {
55
- record = await self . crud . readDocument ( {
56
- collection,
57
- document : {
55
+ record = await self . crud . send ( {
56
+ method : 'read.object' ,
57
+ array,
58
+ object : {
58
59
_id
59
60
} ,
60
61
organization_id
61
62
} ) ;
62
- if ( record && record . document && record . document [ 0 ] )
63
- record = record . document [ 0 ]
63
+ if ( record && record . object && record . object [ 0 ] )
64
+ record = record . object [ 0 ]
64
65
65
66
dbCache . set ( cacheKey , record )
66
67
}
0 commit comments