fix: disable 'Update App' button when no changes are made#7975
fix: disable 'Update App' button when no changes are made#7975Syed-Moiz-Ali wants to merge 2 commits into
Conversation
Greptile SummaryThis PR adds a
Confidence Score: 3/5Two defects in hasDataChanged can cause the button to misbehave in opposite directions — incorrectly enabled by null vs empty-string comparisons, or incorrectly disabled by count-only capability checks. The nullable URL field comparisons will silently report a phantom change on any app where those fields are null, defeating the guard. The capability count check allows a swap of capabilities to go undetected, blocking a legitimate update. app/lib/pages/apps/providers/add_app_provider.dart — hasDataChanged needs null-safe URL comparisons and identity-based capability comparison. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User opens UpdateAppPage] --> B[prepareUpdate called\nisValid=false, hasChanges=false\n_originalApp stored]
B --> C[Button disabled\ngrey colour]
C --> D{User edits a field}
D -->|triggers checkValidity| E[isFormValid evaluated\nhasDataChanged vs _originalApp evaluated]
E --> F{isValid AND hasChanges?}
F -->|Yes| G[Button enabled\nwhite colour]
F -->|No| C
G --> H{User taps Update}
H --> I[validateForm]
I -->|valid| J[Confirmation dialog]
J -->|confirm| K[updateApp called]
K --> L[clear + checkValidity\nNavigator.pop on success]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User opens UpdateAppPage] --> B[prepareUpdate called\nisValid=false, hasChanges=false\n_originalApp stored]
B --> C[Button disabled\ngrey colour]
C --> D{User edits a field}
D -->|triggers checkValidity| E[isFormValid evaluated\nhasDataChanged vs _originalApp evaluated]
E --> F{isValid AND hasChanges?}
F -->|Yes| G[Button enabled\nwhite colour]
F -->|No| C
G --> H{User taps Update}
H --> I[validateForm]
I -->|valid| J[Confirmation dialog]
J -->|confirm| K[updateApp called]
K --> L[clear + checkValidity\nNavigator.pop on success]
|
|
Fixed both issues:
|
ClawSweeper local pilot reviewRecommendation: keep open, but do not merge as-is. What it found:
Suggested next step: recompute dirty state from every editable update-page field, then add redacted app proof showing the button disabled on load, enabled after a valid edit, and disabled again after reverting. Posted from a local report-only ClawSweeper pilot by request; no labels, closes, repairs, or merges were performed. |
Fixes #3559
Problem
The 'Update App' button appears enabled even when the user has not changed any fields, allowing no-op updates.
Changes