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

[Devtools] Make link style value clickable #21827

Closed
otakustay opened this issue Jul 8, 2021 · 17 comments
Closed

[Devtools] Make link style value clickable #21827

otakustay opened this issue Jul 8, 2021 · 17 comments
Labels
Component: Developer Tools Resolution: Stale Automatically closed due to inactivity

Comments

@otakustay
Copy link
Contributor

I didn't find a suitable place to open feature request of react devtools.

We're developing a babel plugin to inject a useDebugValue into every component so that developers can immediately see the source file path of inspecting component like:

image

We are expecting this file:// url clickable and open the default code editor on clicked, like those image urls in DOM panel:

image

This can be a helpful feature to help developers quickly location source files, stackoverflow questions and more

@otakustay otakustay added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jul 8, 2021
@bvaughn bvaughn added Component: Developer Tools good first issue and removed Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug labels Jul 8, 2021
@kkragoth
Copy link

kkragoth commented Jul 8, 2021

Hello,

I am very interested in starting to contribute to this project and I would like to grab this issue since it seems quite easy to start but I've never set up this devtools project so I am little nervous. If I could be pointed in right direction with docs (I saw architecture and dev workflow from issue Combine view highlighting code but all links would be useful!) and starting place for this issue I'd be happy to try this as a first issue

@bvaughn
Copy link
Contributor

bvaughn commented Jul 8, 2021

@kkragoth Feel free to work on this issue!

I just posted a contributing guide which should hopefully have all of the info you need to get started:
https://github.com/facebook/react/blob/main/packages/react-devtools/CONTRIBUTING.md

@bvaughn
Copy link
Contributor

bvaughn commented Jul 8, 2021

Please also keep in mind that links should not be clickable when props are editable, (since this would interfere with editing), only when they're read-only

@PrinceRajRoy
Copy link

PrinceRajRoy commented Jul 9, 2021

@bvaughn I was trying this out, any suggestion how to use/open the default code editor? It works fine with vscode url path as
vscode://file/{path to file}

2021-07-09.15-35-29.mp4

@otakustay
Copy link
Contributor Author

Default editor should be registered system wide, I think it is enough to just open the file:// protocol url and leave OS to decide which app to handle this

@kkragoth
Copy link

kkragoth commented Jul 9, 2021

@otakustay I thought the same but I started working in parallel and file:/// seems to be intercepted by Chrome (for security reasons) and that's the issue that @PrinceRajRoy might be talking about.

Screen.Recording.2021-07-09.at.18.54.23.mov

@PrinceRajRoy
Copy link

@kkragoth indeed, I tried with firefox too, same security issue.

@otakustay
Copy link
Contributor Author

This is not a problem, the displayed string is fully controlled by developers, they can change it to vscode:// if their default editor is vscode, for devtools it just renders a link and all behavior should comply with browser.

@rainedoescode
Copy link

It looks like it may be possible to use process.env.EDITOR to check the user's default text editor, but it's not guaranteed to be a coding environment

@anushaNemilidinne
Copy link

Hello! is anyone working on this issue? Been using React for almost 2 years and I always wanted to contribute to this open source project.

@bvaughn
Copy link
Contributor

bvaughn commented Jul 26, 2021

So far as I know, there is no open PR for this so it's still up for grabs.

@kkragoth
Copy link

I'm little nervous to start PR, but I found out I have some questions that maybe other joining contributors and someone later assigned to issue might ask.

I'v very new to this project so I thought the best place to start is with KeyValue file (edited in PR).

I have some questions that I think will be useful for anyone starting work with this issue being new to project

  • is this the correct place I'm trying to do changes?
  • How can I set in devtools to disallow editing values? Right now for testing I simply set specific booleans (isReadOnly/canEdit...) to appropriate values in code.
  • this issue feels nice to add 'http'/'https' support, not really sure if needed.
  • how one should approach adding tests for this issue?

Also I believe this issue was started as a way for developers to get quickly to source file. Devtools sometimes render 'source' in panel for component. This could be made to be a clickable link instead of copying to clipboard

@bvaughn
Copy link
Contributor

bvaughn commented Jul 26, 2021

How can I set in devtools to disallow editing values? Right now for testing I simply set specific booleans (isReadOnly/canEdit...) to appropriate values in code.

DevTools already has this feature built-in. Sometimes props can be edited (e.g. if you're using a DEV build of React) and sometimes not. We shouldn't change that for this feature. My point was just that links should not be clickable when props are editable because that would break the editing experience.

@kkragoth
Copy link

kkragoth commented Jul 26, 2021

How can I set in devtools to disallow editing values? Right now for testing I simply set specific booleans (isReadOnly/canEdit...) to appropriate values in code.

DevTools already has this feature built-in. Sometimes props can be edited (e.g. if you're using a DEV build of React) and sometimes not. We shouldn't change that for this feature. My point was just that links should not be clickable when props are editable because that would break the editing experience.

I understand and never broke editing experience.

I only had no idea how to start devtools where props can't be modified since I've been only using DEV builds, and now after your comment I know I should've been using production builds. The code I supplied works if props can't be modified then display it as link but if it's editable then nothing changes.

Screenshot 2021-07-26 at 17 42 19

@bvaughn
Copy link
Contributor

bvaughn commented Jul 26, 2021

That seems right then. (Though I suggest using color: var(--color-link); for those styled links to make them fit the theme right.

Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Apr 10, 2024
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Developer Tools Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

No branches or pull requests

6 participants