Skip to content

Commit

Permalink
Added in ability to manually set an internal action ID for surety in …
Browse files Browse the repository at this point in the history
…correct SSR hydration
  • Loading branch information
lostpebble committed Dec 13, 2020
1 parent e639d3e commit 2108095
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/async-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export interface ICreateAsyncActionOptions<A, R, T extends string, N, S extends
cacheBreakHook?: TPullstateAsyncCacheBreakHook<A, R, T, N, S>;
postActionHook?: TPullstateAsyncPostActionHook<A, R, T, N, S>;
subsetKey?: (args: A) => any;
actionId?: string | number;
}

// action.use() types
Expand Down
5 changes: 3 additions & 2 deletions src/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ export function createAsyncAction<A = any,
shortCircuitHook,
cacheBreakHook,
postActionHook,
subsetKey
subsetKey,
actionId
}: ICreateAsyncActionOptions<A, R, T, N, S> = {}
): IOCreateAsyncActionOutput<A, R, T, N> {
const ordinal: number = asyncCreationOrdinal++;
const ordinal: string | number = actionId != null ? `_${actionId}` : asyncCreationOrdinal++;
const onServer: boolean = typeof window === "undefined";

function _createKey(args: A, customKey?: string) {
Expand Down

0 comments on commit 2108095

Please sign in to comment.