carp-dk / carp-dk/research.package

RPUIVisualConsentStep cancel dialog ignores RPUITask.onCancel and pops the host's route

Open
#168 1 comment 0 reactions 1 assignee Claimed by @iarata View on GitHub
bug
Dominant language
Dart
Stars
52
Forks
47
Avg merge
5h 35m
Merged PRs (30d)
4

Description

`lib/src/ui/visual_consent_step.dart:72-74`:

```dart
onPressed: () {
Navigator.of(context).pop(); // Pop the popup
Navigator.of(context).pop(); // Pop the screen
},
```

**Issue:** the visual-consent cancel dialog never fires the `onCancel` callback that `RPUITask` exposes — it just pops the host's route directly, which crashes any host that didn't `Navigator.push` the task (e.g. reached via GoRouter redirect, shell route, or embedded as a tab body).

**Fix:** delegate to `onCancel` when it's defined:

```dart
onPressed: () {
Navigator.of(context).pop(); // dismiss this dialog only
if (widget.onCancel != null) {
widget.onCancel!(null);
} else {
Navigator.of(context).pop(); // legacy: package owns the route
}
},
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.