-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(devtools): Add framework agnostic devtools draft #5347
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2019cb6
feat(devtools): Add framework agnostic devtools draft
ardeora cfa183d
Fix test
ardeora c8f13a6
Move query-devtools build before react-query-devtools
ardeora c6dae00
Fix dimensions bug & add isInitialOpen props
ardeora 3f0c50f
Fix isOpen state
ardeora 4410152
Add devtools cutom errorTypes option
ardeora 5145a4c
Add explicit close button
ardeora dad1c06
Add keyboard focus for tooltips
ardeora 9f1d33a
Add query-core to query-devtools peerDependencies
ardeora 7289416
Update pnpm lock file
ardeora 9233321
Merge branch 'alpha' into framework-agnostic-devtools
TkDodo 0d198ba
Add overflow hidden to hide filters on top view
ardeora 76cbfe0
Revert overflow hidden - causing other issues
ardeora a276517
Update documentation
ardeora bedc0db
Fix validate-packages script
ardeora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,17 @@ | ||
// @ts-check | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
const config = { | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.eslint.json', | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
'react/react-in-jsx-scope': 'off', | ||
'react-hooks/rules-of-hooks': 'off', | ||
'react/jsx-key': 'off', | ||
}, | ||
} | ||
|
||
module.exports = config |
This file contains hidden or 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,50 @@ | ||
{ | ||
"name": "@tanstack/query-devtools", | ||
"version": "5.0.0-alpha.23", | ||
"description": "Developer tools to interact with and visualize the TanStack Query cache", | ||
"author": "tannerlinsley", | ||
"license": "MIT", | ||
"repository": "tanstack/query", | ||
"homepage": "https://tanstack.com/query", | ||
"funding": { | ||
"type": "github", | ||
"url": "https://github.com/sponsors/tannerlinsley" | ||
}, | ||
"types": "./build/types/index.d.ts", | ||
"main": "./build/umd/index.js", | ||
"module": "./build/esm/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./build/esm/index.js", | ||
"require": "./build/umd/index.js" | ||
} | ||
}, | ||
"scripts": { | ||
"clean": "rimraf ./build", | ||
"test:eslint": "eslint --ext .ts,.tsx ./src", | ||
"test:types": "tsc", | ||
"test:lib": "vitest run --coverage", | ||
"test:lib:dev": "pnpm run test:lib --watch", | ||
"build:types": "tsc --build" | ||
}, | ||
"files": [ | ||
"build", | ||
"src" | ||
], | ||
"devDependencies": { | ||
"vite-plugin-solid": "^2.5.0" | ||
}, | ||
"dependencies": { | ||
"@tanstack/query-core": "workspace:*", | ||
"@emotion/css": "^11.10.5", | ||
"@solid-primitives/keyed": "^1.1.4", | ||
"@solid-primitives/resize-observer": "^2.0.15", | ||
"@solid-primitives/storage": "^1.3.9", | ||
"@tanstack/match-sorter-utils": "^8.8.4", | ||
"solid-js": "^1.6.10", | ||
"solid-transition-group": "^0.2.2", | ||
"superjson": "^1.12.1" | ||
}, | ||
"peerDependencies": {}, | ||
"peerDependenciesMeta": {} | ||
} |
This file contains hidden or 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,41 @@ | ||
import type { QueryClient, onlineManager, Query } from '@tanstack/query-core' | ||
import { createContext, useContext } from 'solid-js' | ||
|
||
type XPosition = 'left' | 'right' | ||
type YPosition = 'top' | 'bottom' | ||
export type DevtoolsPosition = XPosition | YPosition | ||
export type DevtoolsButtonPosition = `${YPosition}-${XPosition}` | ||
|
||
export interface DevToolsErrorType { | ||
/** | ||
* The name of the error. | ||
*/ | ||
name: string | ||
/** | ||
* How the error is initialized. | ||
*/ | ||
initializer: (query: Query) => Error | ||
} | ||
|
||
export interface QueryDevtoolsProps { | ||
readonly client: QueryClient | ||
queryFlavor: string | ||
version: string | ||
onlineManager: typeof onlineManager | ||
|
||
buttonPosition?: DevtoolsButtonPosition | ||
position?: DevtoolsPosition | ||
initialIsOpen?: boolean | ||
errorTypes?: DevToolsErrorType[] | ||
} | ||
|
||
export const QueryDevtoolsContext = createContext<QueryDevtoolsProps>({ | ||
client: undefined as unknown as QueryClient, | ||
onlineManager: undefined as unknown as typeof onlineManager, | ||
queryFlavor: '', | ||
version: '', | ||
}) | ||
|
||
export function useQueryDevtoolsContext() { | ||
return useContext(QueryDevtoolsContext) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this works with dependencies and peerDependencies. Does this not mean that the query-devtools will bring their own version of the query-core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is fine for now since we only use the types from query core so nothing from
query-core
is bundled in thequery-devtools
build. But I'll try to add it topeerDependencies
and see if that breaks anything!peerDependencies
would make more sense here. Also will update the scripts/config.ts in a bit!