Skip to content

Commit 2d283a1

Browse files
miglourencoclaude
andcommitted
Allow empty host field so Save works with auto-discovery (1.0.3)
v1.0.2's H6 fix used Regex.IP on the optional host textinput, which rejects the empty string. That locked the Save button whenever the user picked an LV1 from the discovery dropdown (the standard flow): the discovery path needs host to stay empty so the connect logic falls back to the cached IP and port from the dropdown selection. Replace the strict IP regex with `^$|<ipv4>` so the field accepts either an empty string (= auto-discovery is in use) or a valid dotted-quad IPv4 (= manual override). Selected dropdown + empty host is now a valid state. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2c30df3 commit 2d283a1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "companion-module-waves-lv1",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"main": "dist/main.js",
55
"type": "module",
66
"scripts": {

src/config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SomeCompanionConfigField, Regex } from '@companion-module/base'
1+
import { SomeCompanionConfigField } from '@companion-module/base'
22
import { getDiscoveryCache, refreshDiscovery } from './discovery-cache.js'
33

44
export interface ModuleConfig {
@@ -65,7 +65,10 @@ export function GetConfigFields(): SomeCompanionConfigField[] {
6565
label: 'LV1 IP (override)',
6666
width: 6,
6767
default: '',
68-
regex: Regex.IP,
68+
// Accept empty (= use auto-discovery) OR a valid dotted-quad IPv4. We can't use
69+
// Regex.IP here because it rejects the empty string, which would lock the Save
70+
// button whenever the user doesn't want a manual override.
71+
regex: '/^$|^(?:(?:25[0-5]|2[0-4]\\d|1?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1?\\d?\\d)$/',
6972
},
7073
{
7174
type: 'number',

0 commit comments

Comments
 (0)