Fix issue 2251: conditionally render advanced settings button only for newt method #373

Closed
opened 2026-04-05 17:08:08 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @K0lin on 1/17/2026

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

This PR addresses issue #2251 by modifying the conditional rendering of the advanced settings button and associated form field in the site creation page (src/app/[orgId]/settings/sites/create/page.tsx).

Changes Made:

  • Wrapped the advanced settings button and client address form field in a conditional block that only renders when form.watch("method") === "newt".
  • The button is now inside a <> React Fragment, along with the conditional form field.
  • This ensures the UI elements are only displayed when the site method is "newt", eliminating the previous behavior where the button was always rendered.

Analysis of Change:

  • Before: The button and form field were always rendered in the DOM, but hidden when form.watch("method") !== "newt".
  • After: The entire block is conditionally rendered only when the method is "newt", ensuring the UI accurately reflects the current state.

How to test?

  1. Navigate to the site creation page in the application.
  2. Select different site methods using the strategy select (newt, wireguard, local).
  3. Verify that the "Advanced Settings" button (with chevron icon) only appears when "newt" is selected.
*Originally created by @K0lin on 1/17/2026* ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description This PR addresses issue #2251 by modifying the conditional rendering of the advanced settings button and associated form field in the site creation page (`src/app/[orgId]/settings/sites/create/page.tsx`). **Changes Made:** - Wrapped the advanced settings button and client address form field in a conditional block that only renders when `form.watch("method") === "newt"`. - The button is now inside a `<>` React Fragment, along with the conditional form field. - This ensures the UI elements are only displayed when the site method is "newt", eliminating the previous behavior where the button was always rendered. **Analysis of Change:** - **Before:** The button and form field were always rendered in the DOM, but hidden when `form.watch("method") !== "newt"`. - **After:** The entire block is conditionally rendered only when the method is "newt", ensuring the UI accurately reflects the current state. ## How to test? 1. Navigate to the site creation page in the application. 2. Select different site methods using the strategy select (newt, wireguard, local). 3. Verify that the "Advanced Settings" button (with chevron icon) only appears when "newt" is selected.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#373