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

feat(query-devtools): Add picture-in-picture mode #6931

Merged
merged 3 commits into from
Feb 19, 2024

Conversation

ardeora
Copy link
Contributor

@ardeora ardeora commented Feb 19, 2024

Add picture-in-picture view to the query devtools.

This allows the devtools to be detached from the main page and open inside a popup. The components are mounted through a portal onto the new window and all interactions work as expected

Here is a screen recording of the feature in play:

Untitled.mov

Copy link

vercel bot commented Feb 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2024 7:03am

Copy link

nx-cloud bot commented Feb 19, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit de29488. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link

codesandbox-ci bot commented Feb 19, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit de29488:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2024

Codecov Report

Merging #6931 (de29488) into main (26d8980) will decrease coverage by 0.74%.
The diff coverage is 0.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6931      +/-   ##
==========================================
- Coverage   42.11%   41.37%   -0.74%     
==========================================
  Files         180      180              
  Lines        7060     7186     +126     
  Branches     1422     1449      +27     
==========================================
  Hits         2973     2973              
- Misses       3725     3831     +106     
- Partials      362      382      +20     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 83.85% <ø> (ø)
@tanstack/eslint-plugin-query 85.11% <ø> (ø)
@tanstack/query-async-storage-persister 48.43% <ø> (ø)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods 0.00% <ø> (ø)
@tanstack/query-core 93.63% <ø> (ø)
@tanstack/query-devtools 4.11% <0.00%> (-0.36%) ⬇️
@tanstack/query-persist-client-core 57.73% <ø> (ø)
@tanstack/query-sync-storage-persister 82.50% <ø> (ø)
@tanstack/react-query 93.07% <ø> (ø)
@tanstack/react-query-devtools 0.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 84.84% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 62.68% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 70.81% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)

Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing

Copy link

@fh-nabeel-ahmad fh-nabeel-ahmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ardeora ardeora merged commit f419daf into TanStack:main Feb 19, 2024
5 checks passed
@lorand-horvath
Copy link

@ardeora This is really cool! I'd just wish for the detached devtools window to not revert back to default mode as soon as I reload the page. Is that possible?

@ardeora
Copy link
Contributor Author

ardeora commented Feb 19, 2024

@ardeora This is really cool! I'd just wish for the detached devtools window to not revert back to default mode as soon as I reload the page. Is that possible?

Hello! This is a great suggestion. I tried implementing something similar but ran into issues. I would love to hear your thoughts or suggestions if you have any feedback on how we can approach this

  • We can prevent the existing popup from closing on page refresh. But how can a popup attach itself back to the reloaded window?
  • I tried re-opening the popup automatically on page refresh but most browsers require a user-triggered event to open a popup to prevent spam webpages from opening 100s of spam popups

@lorand-horvath
Copy link

The state of the popup (id, size, position, etc.) could be remembered in local storage. Then the main window could read and somehow re-bind/re-attach/grab the existing popup via the stored id and re-size, re-position it. I'm not sure how can a window get a handle on an existing popup... I'll have to check.

@lorand-horvath
Copy link

@ardeora
Copy link
Contributor Author

ardeora commented Feb 19, 2024

Okay amazing! I think I have figured it out. Will open a PR soon. Also thank you so much for helping out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants