Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query-devtools): Fix getSidedProp bug #5551

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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