-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: inconsistent targeting key (#16)
* fix: tracking Signed-off-by: Todd Baert <[email protected]> * fixup: release tag Signed-off-by: Todd Baert <[email protected]> --------- Signed-off-by: Todd Baert <[email protected]>
- Loading branch information
Showing
9 changed files
with
33 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use client' | ||
|
||
import { v4 } from "uuid"; | ||
|
||
export const TARGETING_KEY = v4(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
"use client"; | ||
|
||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { useMemo } from "react"; | ||
import type { EvaluationContext } from "@openfeature/react-sdk"; | ||
|
||
declare module "@tanstack/react-query" { | ||
interface Register { | ||
queryMeta: EvaluationContext; | ||
mutationMeta: EvaluationContext; | ||
} | ||
} | ||
|
||
export function ReactQueryProvider({ | ||
targetingKey, | ||
children, | ||
}: { | ||
targetingKey: string; | ||
children: React.ReactNode; | ||
}) { | ||
const queryClient = useMemo(() => { | ||
return new QueryClient({ | ||
defaultOptions: { | ||
queries: { meta: { targetingKey } }, | ||
mutations: { meta: { targetingKey } }, | ||
}, | ||
}); | ||
}, [targetingKey]); | ||
|
||
return ( | ||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | ||
<QueryClientProvider client={new QueryClient()}>{children}</QueryClientProvider> | ||
); | ||
} |