Skip to content

Commit

Permalink
Make FieldNumber not default to port 22 (and default it to 22 where n…
Browse files Browse the repository at this point in the history
…eeded)
  • Loading branch information
SchoofsKelvin committed Dec 3, 2021
1 parent fa3bc68 commit 00b52d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- Build workflow broke due to using `yarn dlx vsce` and an `vsce` major version update requiring Node 14
- The workflow is now configured to use Node 14 instead of Node 12
- `vsce` is now added as a `devDependency`, which will also result in a speedup due to Yarn caching
- The `FieldNumber` component in the webview now doesn't always default to `22` as value
- This component is only used for the `port` field, which now passes `22` to `FieldNumber` by default

## v1.24.0 (2021-11-02)

Expand Down
2 changes: 1 addition & 1 deletion webview/src/ConfigEditor/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function host(config: FileSystemConfig, onChange: FSCChanged<'host'>): Re
export function port(config: FileSystemConfig, onChange: FSCChanged<'port'>): React.ReactElement {
const callback = (value: number) => onChange('port', value);
const description = 'Port number of the server. Supports environment variables, e.g. $PORT';
return <FieldNumber key="port" label="Port" value={config.port} onChange={callback} optional description={description} />
return <FieldNumber key="port" label="Port" value={config.port || 22} onChange={callback} optional description={description} />
}

export function root(config: FileSystemConfig, onChange: FSCChanged<'root'>): React.ReactElement {
Expand Down
4 changes: 2 additions & 2 deletions webview/src/FieldTypes/number.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import { FieldBase } from './base';

export class FieldNumber extends FieldBase<number | undefined> {
export class FieldNumber extends FieldBase<number> {
public renderInput() {
return <input value={this.state.newValue || 22} onChange={this.onChangeEvent} type="number" />;
return <input value={this.state.newValue} onChange={this.onChangeEvent} type="number" />;
}
public getError() {
const { newValue } = this.state;
Expand Down

0 comments on commit 00b52d7

Please sign in to comment.