diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index a8e66f626..e46ebbca7 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -160,6 +160,7 @@ Future defaultSettingsMigration( case 22: await addNanoNodeList(nodes: nodes); await changeNanoCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes); + await changeNanoCurrentPowNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes); break; default: @@ -574,3 +575,10 @@ Future<void> changeNanoCurrentNodeToDefault( await sharedPreferences.setInt(PreferencesKey.currentNanoNodeIdKey, nodeId); } + +Future<void> changeNanoCurrentPowNodeToDefault( + {required SharedPreferences sharedPreferences, required Box<Node> nodes}) async { + final node = getNanoDefaultPowNode(nodes: nodes); + final nodeId = node?.key as int? ?? 0; + await sharedPreferences.setInt(PreferencesKey.currentNanoPowNodeIdKey, nodeId); +} diff --git a/lib/src/screens/settings/manage_pow_nodes_page.dart b/lib/src/screens/settings/manage_pow_nodes_page.dart index e8f276b38..a2f167a53 100644 --- a/lib/src/screens/settings/manage_pow_nodes_page.dart +++ b/lib/src/screens/settings/manage_pow_nodes_page.dart @@ -45,7 +45,11 @@ class ManagePowNodesPage extends BasePage { }, itemBuilder: (_, sectionIndex, index) { final node = nodeListViewModel.nodes[index]; - final isSelected = node.keyIndex == nodeListViewModel.currentNode.keyIndex; + // technically not correct but the node doesn't + // have any potentially unique attributes (keyIndex -> hashCode) + // and it fixes the bug where the default (pow) node is not highlighted until + // after making a selection + final isSelected = node.hashCode == nodeListViewModel.currentNode.hashCode; final nodeListRow = NodeListRow( title: node.uriRaw, node: node,