CupertinoContextMenu previewBuilder or child widget not getting rebuilt while on fullscreen view, setState() called after dispose(): error when closed

Viewed 358

I am using a CupertinoContextMenu widget to show some data from a Graphql query but I am having some issues with it on a particular use case.

The data updates fine while the CupertinoContextMenu is unpressed but when I press and hold it to activate the menu and have the child go fullscreen, the fields stop updating until I close the menu. Also it seems that the change only displays after the top item closes completely.

I am also having an issue every time I close the context menu with this action:

   CupertinoContextMenuAction(
    child: const Text('Toggle Network'),
    onPressed: () {
      runMutation(
        toggleRunMutation,
        optimisticResult: {
          "action": {
            "returning": [
              {"portStatus": !item.portStatus}
            ]
          }
        },
      );
      Navigator.pop(context);
    },
  ),

Executing the action and closing the context menu generates this error every time:

setState() called after dispose(): _CupertinoContextMenuState#97124(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)

Below a preview of the app. Thanks a lot.

Example App

0 Answers
Related