@@ -24,6 +24,7 @@ export class Origin {
2424 typeof defaultValue !== "undefined" ? cloneDeep ( defaultValue ) : defaultValue ;
2525
2626 this . _customQueries = { } ;
27+ this . customQueries = { } ;
2728 this . test = { } ;
2829
2930 this . _createBaseMethods ( ) ;
@@ -82,10 +83,10 @@ export class Origin {
8283 }
8384
8485 _clean ( query ) {
85- this . _cache . clean ( query ) ;
86+ this . _cache . clean ( query , this ) ;
8687 }
8788
88- _createQueryMethods ( query , queryId ) {
89+ _createQueryMethods ( query , id ) {
8990 const methods = { } ;
9091
9192 const updateData = ( data , methodName , action , params ) => {
@@ -106,7 +107,7 @@ export class Origin {
106107 methods [ methodName ] . error = newData . error ;
107108 this . _emitChange ( query , methodName ) ;
108109 this . _emitChangeAny ( {
109- source : this . _queries [ queryId ] ,
110+ source : this . _queries [ id ] ,
110111 method : methodName ,
111112 action,
112113 params
@@ -219,8 +220,10 @@ export class Origin {
219220 newQuery . _id = `${ this . _id } ${ queryUniqueId ? `-${ queryUniqueId } ` : "" } ` ;
220221 newQuery . actions = actions ;
221222 newQuery . _isSource = true ;
223+ newQuery . _root = this ;
222224
223225 newQuery . query = queryExtension => this . query ( merge ( query , queryExtension ) ) ;
226+ newQuery . customQueries = this . _customQueries ;
224227
225228 Object . keys ( this . _customQueries ) . forEach ( queryKey => {
226229 newQuery [ queryKey ] = queryExtension => {
@@ -236,6 +239,7 @@ export class Origin {
236239 addCustomQueries ( customQueries ) {
237240 Object . keys ( customQueries ) . forEach ( queryKey => {
238241 this . _customQueries [ queryKey ] = customQueries [ queryKey ] ;
242+ this . customQueries [ queryKey ] = customQueries [ queryKey ] ;
239243 this . test . customQueries = this . test . customQueries || { } ;
240244 this . test . customQueries [ queryKey ] = customQueries [ queryKey ] ;
241245 this [ queryKey ] = query => {
0 commit comments