Skip to content

Commit 46fe9ac

Browse files
committed
feat: track unsaved changes and handle revert correctly
1 parent d802b00 commit 46fe9ac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/app/modules/detailRoute/controllers/detail_route_controller.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class DetailRouteController extends GetxController {
4545
}
4646

4747
modify.set(name, newValue);
48-
onEdit.value = true;
48+
49+
// onEdit must reflect REAL changes only
50+
onEdit.value = modify.changes.isNotEmpty;
4951

5052
// If status is being changed, update read-only state
5153
if (name == 'status') {
@@ -68,7 +70,7 @@ class DetailRouteController extends GetxController {
6870
}
6971
var now = DateTime.now().toUtc();
7072
modify.save(modified: () => now);
71-
onEdit.value = false;
73+
onEdit.value = modify.changes.isNotEmpty;
7274

7375
// Show snackbar
7476
Get.snackbar(

0 commit comments

Comments
 (0)