Skip to content

Commit

Permalink
feat(client): add overrideExisting arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Apr 21, 2023
1 parent 958d970 commit 7697391
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/client/src/helpers/defineClientData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const clientDataMap = new Map<InjectionKey<unknown>, unknown>()
*/
export const defineClientData = <T = unknown>(
key: InjectionKey<T>,
data: T
data: T,
overrideExisting = true
): void => {
clientDataMap.set(key, data)
if (overrideExisting || !clientDataMap.has(key)) clientDataMap.set(key, data)
}

0 comments on commit 7697391

Please sign in to comment.