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

Dont prevent adding a watch even if it is blank, fix #936 #958

Closed
wants to merge 8 commits into from

Conversation

BenRussert
Copy link
Member

This should fix #936 by allowing blank watches to be added in the way they are being prevented now.

IIRC what we were doing before here was making sure at least one watch is always there, blank or not. Let me know if you see another issue that will come up by changing this.

The issue brought up in #936:

hydrogen-watch-issue mp4

@rgbkrk
Copy link
Member

rgbkrk commented Aug 28, 2017

Still WIP, or good to go?

@BenRussert
Copy link
Member Author

@rgbkrk I ran out of time before I could fully test it out yesterday. I think there still could be some issues when running watches on multiple kernels.

@BenRussert
Copy link
Member Author

@lgeiger I was having trouble getting the TextEditor we use for input here to render properly. Do you think this could be refactored to use a react component for input?

@BenRussert
Copy link
Member Author

Wow this got a little crazy.

It turns out the multiple kernels issue is on master as well, I haven't been able to fix that. I think it is due to some changes in TextEditor recently.

I think this PR makes a number of things better, including fixing #936.

  • Add "Remove All" in the watches picker (remove all as usual and you'll see this:
    watch-view-remove-all

  • Fix some focus issues

  • Remove watch was failing if called from the command palette instead of the button

  • Add placeholder input text for the current kernel

placeholder


import History from "./../result-view/history";
import type WatchStore from "./../../store/watch";

export default class Watch extends React.Component {
@observer
class Watch extends React.Component {
Copy link
Member Author

Choose a reason for hiding this comment

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

I tried making this an observer to see if it would fix the editor input text issue. It did not help, but I left it based on this


constructor(kernel: Kernel) {
this.kernel = kernel;

this.watches = observable([]);
Copy link
Member Author

Choose a reason for hiding this comment

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

I did this so that I could use watches.clear in remove all. I was under the impression @observable would make this an IObservableArray anyway, but flow doesnt think so. If anyone could explain the difference I would be 🙇 .

@@ -18,7 +18,8 @@ export default class WatchStore {
this.editor = new TextEditor({
softWrapped: true,
grammar: this.kernel.grammar,
lineNumberGutterVisible: false
lineNumberGutterVisible: false,
placeholderText: `Enter ${kernel.displayName} code`
Copy link
Member Author

Choose a reason for hiding this comment

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

To see the rendering issue i've referred to, start two different kernels and add some watches to each. If you tab back and forth you will see this text not update properly.

I'll open a separate issue about this since the underlying problem is in master as well.

@BenRussert
Copy link
Member Author

I am going to close this PR and split it up a bit. I noticed a few different issues as I was working like #963 and just lost track of what changes were necessary 😅 :

@BenRussert BenRussert closed this Sep 2, 2017
@rgbkrk
Copy link
Member

rgbkrk commented Sep 2, 2017

I know that feeling!

@BenRussert
Copy link
Member Author

#972 for posterity

@BenRussert BenRussert deleted the fix-watch-issue branch September 17, 2018 03:37
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.

hydrogen can not add watch again after delete any watch.
3 participants