File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
packages/kit/src/runtime/client/remote-functions Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @sveltejs/kit ' : patch
3+ ---
4+
5+ fix: adjust query's promise implementation to properly allow chaining
Original file line number Diff line number Diff line change @@ -162,15 +162,19 @@ export class Query {
162162 const p = this . #promise;
163163 this . #overrides. length ;
164164
165- return async ( resolve , reject ) => {
166- try {
165+ return ( resolve , reject ) => {
166+ const result = ( async ( ) => {
167167 await p ;
168168 // svelte-ignore await_reactivity_loss
169169 await tick ( ) ;
170- resolve ?. ( /** @type {T } */ ( this . #current) ) ;
171- } catch ( error ) {
172- reject ?. ( error ) ;
170+ return /** @type {T } */ ( this . #current) ;
171+ } ) ( ) ;
172+
173+ if ( resolve || reject ) {
174+ return result . then ( resolve , reject ) ;
173175 }
176+
177+ return result ;
174178 } ;
175179 } ) ;
176180
@@ -250,8 +254,14 @@ export class Query {
250254 this . #then;
251255 return ( /** @type {any } */ fn ) => {
252256 return this . #then(
253- ( ) => fn ( ) ,
254- ( ) => fn ( )
257+ ( value ) => {
258+ fn ( ) ;
259+ return value ;
260+ } ,
261+ ( error ) => {
262+ fn ( ) ;
263+ throw error ;
264+ }
255265 ) ;
256266 } ;
257267 }
You can’t perform that action at this time.
0 commit comments