File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
tests/runtime-runes/samples/get-abort-signal Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ export const LOADING_ATTR_SYMBOL = Symbol('');
2828export const PROXY_PATH_SYMBOL = Symbol ( 'proxy path' ) ;
2929
3030// allow users to ignore aborted signal errors if `reason.stale`
31- export const STALE_REACTION = { stale : true } ;
31+ export const STALE_REACTION = new ( class StaleReactionError extends Error {
32+ name = 'StaleReactionError' ;
33+ message = 'The reaction that called `getAbortSignal()` was re-run or destroyed' ;
34+ } ) ( ) ;
3235
3336export const ELEMENT_NODE = 1 ;
3437export const TEXT_NODE = 3 ;
Original file line number Diff line number Diff line change @@ -7,7 +7,11 @@ export default test({
77 await new Promise ( ( f ) => setTimeout ( f , 50 ) ) ;
88
99 if ( variant === 'hydrate' ) {
10- assert . deepEqual ( logs , [ 'aborted' , { stale : true } ] ) ;
10+ assert . deepEqual ( logs , [
11+ 'aborted' ,
12+ 'StaleReactionError' ,
13+ 'The reaction that called `getAbortSignal()` was re-run or destroyed'
14+ ] ) ;
1115 }
1216
1317 logs . length = 0 ;
@@ -21,6 +25,10 @@ export default test({
2125 await new Promise ( ( f ) => setTimeout ( f , 50 ) ) ;
2226 assert . htmlEqual ( target . innerHTML , '<button>increment</button><p>2</p>' ) ;
2327
24- assert . deepEqual ( logs , [ 'aborted' , { stale : true } ] ) ;
28+ assert . deepEqual ( logs , [
29+ 'aborted' ,
30+ 'StaleReactionError' ,
31+ 'The reaction that called `getAbortSignal()` was re-run or destroyed'
32+ ] ) ;
2533 }
2634} ) ;
Original file line number Diff line number Diff line change 1111 await new Promise ((f ) => setTimeout (f));
1212
1313 if (signal .aborted ) {
14- console .log (' aborted' , signal .reason );
14+ console .log (' aborted' , signal .reason . name , signal . reason . message );
1515 }
1616
1717 return c;
You can’t perform that action at this time.
0 commit comments