-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(traces): make column selector sync'd between tabs (#1816)
* fix(traces): make column selector sync'd between tabs * lint * reverse the aliasing so columns show/hide together
- Loading branch information
1 parent
63ac7f9
commit 631f3c8
Showing
11 changed files
with
192 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { createContext, PropsWithChildren, useRef } from "react"; | ||
import { useZustand } from "use-zustand"; | ||
|
||
import { | ||
createTracingStore, | ||
TracingProps, | ||
TracingState, | ||
TracingStore, | ||
} from "@phoenix/store/tracingStore"; | ||
|
||
export const TracingContext = createContext<TracingStore | null>(null); | ||
|
||
export function TracingProvider({ | ||
children, | ||
...props | ||
}: PropsWithChildren<Partial<TracingProps>>) { | ||
const storeRef = useRef<TracingStore>(); | ||
if (!storeRef.current) { | ||
storeRef.current = createTracingStore(props); | ||
} | ||
return ( | ||
<TracingContext.Provider value={storeRef.current}> | ||
{children} | ||
</TracingContext.Provider> | ||
); | ||
} | ||
|
||
export function useTracingContext<T>( | ||
selector: (state: TracingState) => T, | ||
equalityFn?: (left: T, right: T) => boolean | ||
): T { | ||
const store = React.useContext(TracingContext); | ||
if (!store) throw new Error("Missing TracingContext.Provider in the tree"); | ||
return useZustand(store, selector, equalityFn); | ||
} |
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
20 changes: 10 additions & 10 deletions
20
app/src/pages/tracing/__generated__/TracesTableQuery.graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.