@@ -18,42 +18,6 @@ class AsyncStateNavigator extends StateNavigator {
18
18
this . offNavigate = stateNavigator . offNavigate . bind ( stateNavigator ) ;
19
19
}
20
20
21
- refresh ( navigationData ?: any , historyAction ?: 'add' | 'replace' | 'none' ) {
22
- const refreshData = { ...this . stateContext . state . defaults , ...navigationData } ;
23
- const refreshKeys = Object . keys ( refreshData ) ;
24
- let equal = refreshKeys . length === Object . keys ( this . stateContext . data ) . length ;
25
- for ( let i = 0 ; i < refreshKeys . length && equal ; i ++ ) {
26
- const key = refreshKeys [ i ] ;
27
- equal = equal && AsyncStateNavigator . areEqual ( refreshData [ key ] , this . stateContext . data [ key ] ) ;
28
- }
29
- if ( ! equal )
30
- super . refresh ( navigationData , historyAction ) ;
31
- else {
32
- const { oldState, state, data, asyncData } = this . stateContext ;
33
- const startTransition = React . startTransition || ( ( transition ) => transition ( ) ) ;
34
- startTransition ( ( ) => {
35
- this . navigationHandler . setState ( { context : { ignoreCache : true , oldState, state, data, asyncData, stateNavigator : this } } ) ;
36
- } ) ;
37
- }
38
- }
39
-
40
- private static areEqual ( val : any , currentVal : any ) : boolean {
41
- if ( currentVal == null )
42
- return val == null || val === '' ;
43
- const valType = Object . prototype . toString . call ( val ) ;
44
- if ( valType !== Object . prototype . toString . call ( currentVal ) )
45
- return false ;
46
- if ( valType === '[object Array]' ) {
47
- let active = val . length === currentVal . length ;
48
- for ( let i = 0 ; active && i < val . length ; i ++ ) {
49
- active = this . areEqual ( val [ i ] , currentVal [ i ] ) ;
50
- }
51
- return active ;
52
- } else {
53
- return isNaN ( val ) ? val === currentVal : + val === + currentVal ;
54
- }
55
- }
56
-
57
21
navigateLink ( url : string , historyAction : 'add' | 'replace' | 'none' = 'add' , history = false ,
58
22
suspendNavigation ?: ( stateContext : StateContext , resumeNavigation : ( ) => void ) => void ,
59
23
currentContext = this . stateContext ) {
0 commit comments