Skip to content

Commit

Permalink
fix(fsm): remove initialState from AlwatrFetchStateMachineConfig
Browse files Browse the repository at this point in the history
BREAKING CHANGE: initialState remove from AlwatrFetchStateMachineConfig
  • Loading branch information
alimd committed Nov 6, 2024
1 parent 4952c4c commit fcb9541
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/fetch-state-machine/src/base.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
AlwatrFluxStateMachineBase,
type StateRecord,
type ActionRecord,
type AlwatrFluxStateMachineConfig
} from '@alwatr/fsm';
import {AlwatrFluxStateMachineBase, type StateRecord, type ActionRecord, type AlwatrFluxStateMachineConfig} from '@alwatr/fsm';
import {packageTracer, fetch, type FetchOptions} from '@alwatr/nanolib';

__dev_mode__: packageTracer.add(__package_name__, __package_version__);
Expand All @@ -13,7 +8,7 @@ export type ServerRequestEvent = 'request' | 'requestFailed' | 'requestSucceeded

export type {FetchOptions};

export interface AlwatrFetchStateMachineConfig<S extends string> extends AlwatrFluxStateMachineConfig<S> {
export interface AlwatrFetchStateMachineConfig<S extends string> extends Omit<AlwatrFluxStateMachineConfig<S>, 'initialState'> {
fetch: Partial<FetchOptions>;
}

Expand Down Expand Up @@ -47,7 +42,10 @@ export abstract class AlwatrFetchStateMachineBase<

constructor(config: AlwatrFetchStateMachineConfig<ServerRequestState | ExtraState>) {
config.loggerPrefix ??= 'fetch-state-machine';
super(config);
super({
...config,
initialState: 'initial',
});
this.baseFetchOptions_ = config.fetch;
}

Expand Down

0 comments on commit fcb9541

Please sign in to comment.