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

Setting Hit Count for a breakpoint sometimes sets Expression instead #12547

Closed
pisv opened this issue May 18, 2023 · 1 comment · Fixed by #12567
Closed

Setting Hit Count for a breakpoint sometimes sets Expression instead #12547

pisv opened this issue May 18, 2023 · 1 comment · Fixed by #12567
Labels
debug issues that related to debug functionality

Comments

@pisv
Copy link
Contributor

pisv commented May 18, 2023

Steps to Reproduce:

  1. Using Theia Electron (or Browser) Example on the master branch,
    add a source breakpoint in a JavaScript (or TypeScript) file.

  2. Edit the breakpoint and set a Hit Count.

  3. Edit the breakpoint again and remove the Hit Count.

  4. Edit the breakpoint once again and set a Hit Count.

  5. Note that the breakpoint has an Expression set to the value entered for the Hit Count (which can be seen in a tooltip for the breakpoint, and also in a debugger).

Observed Expected
Screenshot Screenshot
@vince-fugnitto vince-fugnitto added the debug issues that related to debug functionality label May 23, 2023
@pisv
Copy link
Contributor Author

pisv commented May 26, 2023

The source of the issue is that at step 4 the value initially selected in the select component of the DebugBreakpointWidget ('hitCondition') does not match the value of this.context ('condition').

It looks like the code in the DebugBreakpointWidget.render method attempts to synchronize the selection with the context using the defaultValue property of the SelectComponent:

protected render(): void {
if (this._input) {
this._input.getControl().setValue(this._values[this.context] || '');
}
this.selectNodeRoot.render(<SelectComponent
defaultValue={this.context} onChange={this.updateInput}
options={[
{ value: 'condition', label: nls.localizeByDefault('Expression') },
{ value: 'hitCondition', label: nls.localizeByDefault('Hit Count') },
{ value: 'logMessage', label: nls.localizeByDefault('Log Message') },
]}
/>);
}

However, this property sets the selection at construction time only; it has no effect when the component is re-rendered.

I'll try to provide a patch.

pisv added a commit to pisv/theia that referenced this issue May 26, 2023
pisv added a commit to pisv/theia that referenced this issue May 26, 2023
vince-fugnitto pushed a commit that referenced this issue Jul 26, 2023
…12567)

Fixes #12547.

The commit fixes an issue with the `DebugBreakpointWidget` where the current value in the select component was not properly set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants