Skip to content

refactor(web): network connection form UX (part 5)#3352

Merged
dgdavid merged 6 commits intoenhance-network-connection-formfrom
network-tanstack-form-part5
Apr 7, 2026
Merged

refactor(web): network connection form UX (part 5)#3352
dgdavid merged 6 commits intoenhance-network-connection-formfrom
network-tanstack-form-part5

Conversation

@dgdavid
Copy link
Copy Markdown
Contributor

@dgdavid dgdavid commented Apr 1, 2026

A continuation of network connection form reimplementation, built on top of #3351.

It prefills connection name when creating a new connection with a value based based on the connection type and the selected binding:

  • Any device: connection type only, no suffix. E.g., "ethernet"
  • Chosen by name: connection type and device name. E.g., "ethernet_enp1s0"
  • Chosen by MAC: connection type and device MAC address. E.g., "ethernet_001122334455" (colons stripped)

The name updates reactively as the user changes the binding or device selection. Once the user manually edits the Name field, auto-filling stops.

If the base name is already taken by an existing connection, a numeric suffix is appended (ethernet_2, ethernet_3, etc).

Check the not so good screencast below

auto-generated-connection-name.mp4

Interesting reading:

Notes for reviewers

dgdavid added 2 commits April 1, 2026 11:06
Returns a unique auto-generated connection name based on a type string
and binding options (mode, interface name, MAC address). If the base
name is already taken by an existing connection, a numeric suffix is
appended (e.g. "ethernet_2").
When creating a new connection, the Name field is pre-filled with a
value derived from the connection type and the selected binding
(e.g. "ethernet", "ethernet_enp1s0", "ethernet_001122334455").
The name updates reactively as the user changes the binding or device.
Once the user manually edits the name field, auto-filling stops.
@dgdavid dgdavid changed the title Network tanstack form part5 refactor(web): network connection form UX (part 5) Apr 1, 2026
@ancorgs
Copy link
Copy Markdown
Contributor

ancorgs commented Apr 1, 2026

I'm not advocating for it, but note it is not unusual to have spaces in the connection names (starting with a capital letter).

For example, the default connection created during the live-ISO boot is called "Wired connection 1". Also, if I use the applet from my desktop and select "New connection" -> "Ethernet" I get the name pre-filled as "Ethernet connection 1".

And for WiFi connections, it is quite common to use the ESSID to name of the connection.

Having said so, I have nothing against the suggested names in this PR. They look like names I myself would have used. 😉

@dgdavid

This comment was marked as resolved.

@dgdavid

This comment was marked as resolved.

@dgdavid
Copy link
Copy Markdown
Contributor Author

dgdavid commented Apr 1, 2026

Something really easy to change, thought. Let's move the question for the final PR against master branch. Unless you feel it is better addressing it here instead.

Thinking it twice, let's do it now

Done! Check 5f353c1. As said, different format (adding the work connection, omitting the device, whatever) can be changed later by somebody.

@ancorgs
Copy link
Copy Markdown
Contributor

ancorgs commented Apr 1, 2026

Two weird things I found during manual testing regarding editing a connection:

  • If one connection is created for "any" (unbound), then I go to "edit connection" and choose "by name", then the second select-box is initialized to an empty value (that is not actually among the options I can select if I open the select-box). Saving in that situation takes the connection back to unbound, which is not that bad.
  • I was able to edit a WiFi connection and bind it to an ethernet (or even local loopback) device. I feel there should be some relationship between the type of connection and the devices I can choose. Especially because creating a WiFi connection is done in a different format in which I cannot select the bound device.

Maybe the second one is not that much related to this pull request, but about the nature of editing connections as a concept.

@dgdavid
Copy link
Copy Markdown
Contributor Author

dgdavid commented Apr 1, 2026

Two weird things I found during manual testing regarding editing a connection:

  • If one connection is created for "any" (unbound), then I go to "edit connection" and choose "by name", then the second select-box is initialized to an empty value (that is not actually among the options I can select if I open the select-box). Saving in that situation takes the connection back to unbound, which is not that bad.
  • I was able to edit a WiFi connection and bind it to an ethernet (or even local loopback) device. I feel there should be some relationship between the type of connection and the devices I can choose. Especially because creating a WiFi connection is done in a different format in which I cannot select the bound device.

Maybe the second one is not that much related to this pull request, but about the nature of editing connections as a concept.

Thanks a ton for such a testing. Both were overlooked by me.

The first one is quite weird, but I guess easy to fix.

The second one was totally out of the scope of this refactor because there would be a serie of follow-up PRs adding the ability of creating/editing different types of connections. While Wi-Fi can be already created because historical reasons, it deserves some love yet. In short, for a separated PR in the context of extending the network support.

When switching from "Any device" binding mode, the device selector
is empty with no device selected. An onMount listener now sets
the first available device if the field has no value, using
`dontUpdateMeta` to keep the pre-fill transparent to form state.
@dgdavid
Copy link
Copy Markdown
Contributor Author

dgdavid commented Apr 1, 2026

Two weird things I found during manual testing regarding editing a connection:

  • If one connection is created for "any" (unbound), then I go to "edit connection" and choose "by name", then the second select-box is initialized to an empty value (that is not actually among the options I can select if I open the select-box). Saving in that situation takes the connection back to unbound, which is not that bad.

Fixed with c5f398b

About dontUpdateMeta,

Copy link
Copy Markdown
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

LGTM

@dgdavid dgdavid merged commit e5973cc into enhance-network-connection-form Apr 7, 2026
4 checks passed
@dgdavid dgdavid deleted the network-tanstack-form-part5 branch April 7, 2026 10:56
dgdavid added a commit that referenced this pull request Apr 7, 2026
Built on top of #3352, this
PR fixes a small but noticeable UX gap found while recording the
screencast for the referenced PR: when switching between "Chosen by
name" and "Chosen by MAC" binding modes, the device selection was lost
and the user had to re-pick it.

To fix it, one of the components has gained the ability to trigger
listeners on demand, making it possible to wire the two different
selectors instantiated under the hood and keep them in sync. Note that
although only one instance is mounted at a time and there is no real
risk of listener loops, `dontRunListeners: true` is still passed to the
`setFieldValue` call inside the listener as a safety net.


Related to:


* https://tanstack.com/form/latest/docs/framework/react/guides/listeners
* TanStack/form#1680
* TanStack/form#2104
@imobachgs imobachgs mentioned this pull request Apr 14, 2026
imobachgs added a commit that referenced this pull request Apr 14, 2026
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.

2 participants