Skip to content

Commit

Permalink
Improved performance of save confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Nov 25, 2023
1 parent 2af3b12 commit 988a3c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {

final List<TabData> tabData = [];

final Function mapEquals = const DeepCollectionEquality().equals;

int currentTabIndex = 0;

bool addWidgetDialogVisible = false;
Expand Down Expand Up @@ -161,8 +163,7 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
jsonDecode(_preferences.getString(PrefKeys.layout) ?? '{}');
Map<String, dynamic> currentJson = toJson();

bool showConfirmation =
!const DeepCollectionEquality().equals(savedJson, currentJson);
bool showConfirmation = !mapEquals(savedJson, currentJson);

if (showConfirmation) {
showWindowCloseConfirmation(context);
Expand Down

0 comments on commit 988a3c6

Please sign in to comment.