File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/autocomplete-core/src Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export function createStore<TItem>(
2525 return state ;
2626 } ,
2727 send ( action , payload ) {
28+ const prevState = { ...state } ;
2829 state = enhanceState (
2930 reducer ( state , {
3031 type : action ,
@@ -33,7 +34,7 @@ export function createStore<TItem>(
3334 } )
3435 ) ;
3536
36- props . onStateChange ( { state } ) ;
37+ props . onStateChange ( { state, prevState } ) ;
3738 } ,
3839 } ;
3940}
Original file line number Diff line number Diff line change @@ -198,7 +198,10 @@ export interface AutocompleteOptions<TItem> {
198198 /**
199199 * Function called when the internal state changes.
200200 */
201- onStateChange ?< TItem > ( props : { state : AutocompleteState < TItem > } ) : void ;
201+ onStateChange ?< TItem > ( props : {
202+ state : AutocompleteState < TItem > ;
203+ prevState : AutocompleteState < TItem > ;
204+ } ) : void ;
202205 /**
203206 * The text that appears in the search box input when there is no query.
204207 */
@@ -282,7 +285,10 @@ export interface InternalAutocompleteOptions<TItem>
282285 extends AutocompleteOptions < TItem > {
283286 debug : boolean ;
284287 id : string ;
285- onStateChange < TItem > ( props : { state : AutocompleteState < TItem > } ) : void ;
288+ onStateChange < TItem > ( props : {
289+ state : AutocompleteState < TItem > ;
290+ prevState : AutocompleteState < TItem > ;
291+ } ) : void ;
286292 placeholder : string ;
287293 autoFocus : boolean ;
288294 defaultHighlightedIndex : number | null ;
You can’t perform that action at this time.
0 commit comments