Compare commits

...

5 Commits

Author SHA1 Message Date
Mauricio Siu
73e4fdd757 Merge pull request #4626 from veksen/veksen/textarea-resets-while-editing
fix: prevent environment form from resetting while editing
2026-07-22 14:33:42 -06:00
Mauricio Siu
0fc75840d2 Merge pull request #4890 from SteadEXE/canary
fix(ui): add cursor pointer style for buttons
2026-07-22 00:12:53 -06:00
autofix-ci[bot]
79c127b03b [autofix.ci] apply automated fixes 2026-07-22 06:03:44 +00:00
Jordan B
f2148040a3 Add cursor pointer style for buttons
Added cursor pointer style for buttons and roles.
2026-07-22 08:01:02 +02:00
Jean-Philippe Sirois
86ea311714 fix: prevent environment form from resetting while editing
The application environment editor shares the application.one query with
its parent page, which polls every 5s. Each refetch pushed fresh data
into a useEffect that called form.reset(), wiping any in-progress edits
(e.g. while scrolling down to the Save button). Gate the reset on the
form not being dirty so background refetches no longer clobber unsaved
edits, and reset the dirty baseline after a successful save so the form
re-syncs with the server normally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 20:28:02 -04:00
2 changed files with 11 additions and 2 deletions

View File

@@ -60,14 +60,16 @@ export const ShowEnvironment = ({ applicationId }: Props) => {
const currentBuildArgs = form.watch("buildArgs"); const currentBuildArgs = form.watch("buildArgs");
const currentBuildSecrets = form.watch("buildSecrets"); const currentBuildSecrets = form.watch("buildSecrets");
const currentCreateEnvFile = form.watch("createEnvFile"); const currentCreateEnvFile = form.watch("createEnvFile");
const { isDirty } = form.formState;
const hasChanges = const hasChanges =
currentEnv !== (data?.env || "") || currentEnv !== (data?.env || "") ||
currentBuildArgs !== (data?.buildArgs || "") || currentBuildArgs !== (data?.buildArgs || "") ||
currentBuildSecrets !== (data?.buildSecrets || "") || currentBuildSecrets !== (data?.buildSecrets || "") ||
currentCreateEnvFile !== (data?.createEnvFile ?? true); currentCreateEnvFile !== (data?.createEnvFile ?? true);
// Skip reset while editing so background refetches don't wipe edits
useEffect(() => { useEffect(() => {
if (data) { if (data && !isDirty) {
form.reset({ form.reset({
env: data.env || "", env: data.env || "",
buildArgs: data.buildArgs || "", buildArgs: data.buildArgs || "",
@@ -75,7 +77,7 @@ export const ShowEnvironment = ({ applicationId }: Props) => {
createEnvFile: data.createEnvFile ?? true, createEnvFile: data.createEnvFile ?? true,
}); });
} }
}, [data, form]); }, [data, isDirty, form]);
const onSubmit = async (formData: EnvironmentSchema) => { const onSubmit = async (formData: EnvironmentSchema) => {
mutateAsync({ mutateAsync({
@@ -87,6 +89,7 @@ export const ShowEnvironment = ({ applicationId }: Props) => {
}) })
.then(async () => { .then(async () => {
toast.success("Environments Added"); toast.success("Environments Added");
form.reset(formData);
await refetch(); await refetch();
}) })
.catch(() => { .catch(() => {

View File

@@ -269,6 +269,12 @@
@apply bg-background text-foreground; @apply bg-background text-foreground;
} }
/* Cursor pointer on buttons */
button:not([disabled]),
[role="button"]:not([disabled]) {
cursor: pointer;
}
/* Custom scrollbar styling */ /* Custom scrollbar styling */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0.3125rem; width: 0.3125rem;