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 @@ -163,15 +163,19 @@ export class Query {
163163 const p = this . #promise;
164164 this . #overrides. length ;
165165
166- return async ( resolve , reject ) => {
167- try {
166+ return ( resolve , reject ) => {
167+ const result = ( async ( ) => {
168168 await p ;
169169 // svelte-ignore await_reactivity_loss
170170 await tick ( ) ;
171- resolve ?. ( /** @type {T } */ ( this . #current) ) ;
172- } catch ( error ) {
173- reject ?. ( error ) ;
171+ return /** @type {T } */ ( this . #current) ;
172+ } ) ( ) ;
173+
174+ if ( resolve || reject ) {
175+ return result . then ( resolve , reject ) ;
174176 }
177+
178+ return result ;
175179 } ;
176180 } ) ;
177181
@@ -251,8 +255,14 @@ export class Query {
251255 this . #then;
252256 return ( /** @type {any } */ fn ) => {
253257 return this . #then(
254- ( ) => fn ( ) ,
255- ( ) => fn ( )
258+ ( value ) => {
259+ fn ( ) ;
260+ return value ;
261+ } ,
262+ ( error ) => {
263+ fn ( ) ;
264+ throw error ;
265+ }
256266 ) ;
257267 } ;
258268 }
You can’t perform that action at this time.
0 commit comments