Skip to content

Commit

Permalink
feat(createInjectionState): injectionKey use composable name (#3788)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxuyang950313 committed Feb 20, 2024
1 parent 31d4a49 commit c2cfd34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/shared/createInjectionState/index.ts
Expand Up @@ -19,7 +19,7 @@ export function createInjectionState<Arguments extends Array<any>, Return>(
composable: (...args: Arguments) => Return,
options?: CreateInjectionStateOptions<Return>,
): readonly [useProvidingState: (...args: Arguments) => Return, useInjectedState: () => Return | undefined] {
const key: string | InjectionKey<Return> = options?.injectionKey || Symbol('InjectionState')
const key: string | InjectionKey<Return> = options?.injectionKey || Symbol(composable.name || 'InjectionState')
const useProvidingState = (...args: Arguments) => {
const state = composable(...args)
provideLocal(key, state)
Expand Down

0 comments on commit c2cfd34

Please sign in to comment.