mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: raise get updater error
This commit is contained in:
parent
c3cf54f0b0
commit
b7b0ca346a
1 changed files with 7 additions and 4 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import * as React from 'react'
|
||||
|
||||
type x = [] extends any[] ? [] : any[]
|
||||
import { raiseError } from 'analytics'
|
||||
|
||||
export type Method<Args = any[]> = (
|
||||
...args: Args extends any[] ? Args : any[]
|
||||
|
|
@ -82,8 +81,12 @@ function link<P, S>(instance: React.Component<P, S>, sources: Sources<P, S>): Wr
|
|||
const dispatchState: DispatchState<P, S> = (updater, callback) => {
|
||||
instance.setState(updater, callback)
|
||||
}
|
||||
const prepareState: PreDispatch<P, S> = updater => {
|
||||
updater(instance.state, instance.props)
|
||||
const prepareState: PreDispatch<P, S> = async updater => {
|
||||
try {
|
||||
await updater(instance.state, instance.props)
|
||||
} catch (error) {
|
||||
raiseError(error)
|
||||
}
|
||||
}
|
||||
const dispatch: Dispatch<P, S> = {
|
||||
call: dispatchCall,
|
||||
|
|
|
|||
Loading…
Reference in a new issue