From cc3c3b139031d9eada4b27b2e7ba84bf7f7ba4c6 Mon Sep 17 00:00:00 2001 From: Fabian Ising Date: Thu, 26 Nov 2026 10:57:46 +0100 Subject: [PATCH] fix(acls): keep the policy editor's search panel open Pass stable extensions and onChange to CodeMirror so re-renders no longer reconfigure the editor, which dropped the lazily added search state. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + app/routes/acls/components/cm.client.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ba2080dd..1f77e3b73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ ## Fixes - Headplane's agent and Browser SSH are now built with Go 1.27.3, which stops trusting a small set of intermediate certificates from a compromised certificate authority. The `ip-address` dependency is also updated to fix a denial of service from very long addresses. +- Search and replace in the Access Control file editor stays open while editing. Previously the search panel closed after the first replacement, after typing in the editor, or whenever the page refreshed its data in the background (closes [#698](https://github.com/tale/headplane/issues/698)). - Saving from the Rules or Tags & Groups tabs no longer drops the comma from text like `,}` or `,]` inside a policy value. - Live updates work again right after signing in. Previously the machines list and other pages only refreshed on their own after a full page reload. - Changes to DNS settings and sign-in restrictions now actually apply with the `proc` and `kubernetes` integrations. Both sent `SIGHUP`, which only makes Headscale reload its ACL policy. They now stop Headscale with `SIGTERM` and wait for systemd or Kubernetes to restart it, so Headscale needs a supervisor that restarts it. diff --git a/app/routes/acls/components/cm.client.tsx b/app/routes/acls/components/cm.client.tsx index 2eb73ece1..a8eb10b1e 100644 --- a/app/routes/acls/components/cm.client.tsx +++ b/app/routes/acls/components/cm.client.tsx @@ -56,10 +56,10 @@ export function Editor(props: EditorProps) { props.onChange(value)} + onChange={props.onChange} readOnly={props.isDisabled} theme={headplaneTheme} value={props.value} @@ -80,6 +80,10 @@ const policyLinter = linter((view): Diagnostic[] => { })); }); +// Keep extensions and onChange stable: when either changes identity, +// react-codemirror reconfigures the editor and drops the search panel. +const editorExtensions = [shopify.jsonc(), policyLinter, lintGutter()]; + interface DifferProps { left: string; right: string;