Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
fix(query-devtools): Fix getSidedProp bug
  • Loading branch information
Aryan Deora committed Jun 9, 2023
commit d0be7e10a7b9d6aefd2da70974bd0d2b0c80a60a
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