Skip to content

Commit

Permalink
fix(query-devtools): Fix getSidedProp bug (#5551)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardeora authored Jun 9, 2023
1 parent 17506cc commit dac5f97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/query-devtools/src/Devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,9 @@ export const DevtoolsPanel: Component<DevtoolsPanelProps> = (props) => {
createEffect(() => {
const rootContainer = panelRef.parentElement?.parentElement?.parentElement
if (!rootContainer) return
const styleProp = getSidedProp(
'padding',
props.localStore.position as DevtoolsPosition,
)
const currentPosition = (props.localStore.position ||
POSITION) as DevtoolsPosition
const styleProp = getSidedProp('padding', currentPosition)
const isVertical =
props.localStore.position === 'left' ||
props.localStore.position === 'right'
Expand Down
13 changes: 12 additions & 1 deletion packages/react-query-devtools/src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface DevtoolsOptions {
errorTypes?: DevToolsErrorType[]
}

export function ReactQueryDevtools(
function ReactQueryDevtoolsDev(
props: DevtoolsOptions,
): React.ReactElement | null {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -93,3 +93,14 @@ export function ReactQueryDevtools(

return <div ref={ref}></div>
}

function ReactQueryDevtoolsProd(
_props: DevtoolsOptions,
): React.ReactElement | null {
return null
}

export const ReactQueryDevtools: typeof ReactQueryDevtoolsDev =
process.env.NODE_ENV !== 'development'
? ReactQueryDevtoolsProd
: ReactQueryDevtoolsDev

0 comments on commit dac5f97

Please sign in to comment.