archethic-foundation / archethic-wallet

Archethic Wallet
GNU Affero General Public License v3.0
57 stars 25 forks source link

AccountsListWidget error #636

Closed redDwarf03 closed 1 year ago

redDwarf03 commented 1 year ago

Describe the problem you discovered

When we refresh account list and while the loading we go to NFT list, an error occurs after the loading of NFT

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
#0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>
package:flutter/…/widgets/framework.dart:4241
#1      Element._debugCheckStateIsActiveForAncestorLookup
package:flutter/…/widgets/framework.dart:4255
#2      Element.getElementForInheritedWidgetOfExactType
package:flutter/…/widgets/framework.dart:4286
#3      ProviderScope.containerOf
package:flutter_riverpod/src/framework.dart:102
#4      ConsumerStatefulElement.read
package:flutter_riverpod/src/consumer.dart:607
#5      AccountsListWidget.build.<anonymous closure>.<anonymous closure>
package:aewallet/…/layouts/account_list.dart:43
<asynchronous suspension>

Describe the solution you'd like

No response

redDwarf03 commented 1 year ago

And when we create an account and go just after to NFT page, an error occurs

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: This widget has been unmounted, so the State no longer has a context (and should be considered defunct).
Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.
#0      State.context.<anonymous closure>
package:flutter/…/widgets/framework.dart:935
#1      State.context
package:flutter/…/widgets/framework.dart:941
#2      _AddAccountConfirmState._showSendSucceed
package:aewallet/…/components/add_account_confirm_sheet.dart:114
<asynchronous suspension>
#3      _AddAccountConfirmState._registerBus.<anonymous closure>
package:aewallet/…/components/add_account_confirm_sheet.dart:73
<asynchronous suspension>
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: This widget has been unmounted, so the State no longer has a context (and should be considered defunct).
Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.
#0      State.context.<anonymous closure>
package:flutter/…/widgets/framework.dart:935
#1      State.context
package:flutter/…/widgets/framework.dart:941
#2      _AddAccountConfirmState._showSendSucceed
package:aewallet/…/components/add_account_confirm_sheet.dart:114
<asynchronous suspension>
#3      _AddAccountConfirmState._registerBus.<anonymous closure>
package:aewallet/…/components/add_account_confirm_sheet.dart:73
<asynchronous suspension>
Chralu commented 1 year ago

This bug could have been caused by misused ref.watch. So I fixed those in https://github.com/archethic-foundation/archethic-wallet/pull/650

The problem still remains. It strongly seems related to https://github.com/rrousselGit/riverpod/issues/2041.

redDwarf03 commented 1 year ago

issue fixed in 3.1.0