fix(notifications): answer whether the confirmed delete went ahead - #122
Conversation
magic_notifications 0.2.0 changes NotificationsListView.onDelete to Future<bool>, so _confirmThenDelete now reports its decision: false when it refuses (no navigator to ask in, or somebody said no), true after a delete the server accepted. That answer is why the signature changed. The list reloads its page after a real delete, because a row leaving page one pulls one up from page two and only the server knows which. With nothing to read it had to reload after every tap, so the confirmation dialog this package added in the same unreleased block was costing a full GET /notifications every time somebody declined it. The pin moves to ^0.2.0 in the same commit, because the old pin admits a version whose onDelete has the other signature and would not compile. 1409 tests pass. A decline answering true turns the new case red.
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The The signature change lines up with what the consumer actually does: Minor
TestsCovered, and the new case is the one that was missing. Checks I ran
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The comment above the constraint still narrated 0.1.0 as the floor while the line below it read ^0.2.0. It came in with #122 rather than with the bump, but this is the release that ships that file to pub.dev and the dependency floor is the stated point of it, so an adopter reading the published pubspec would have found the prose arguing against the constraint. Also says WHY 0.2.0 rather than 0.1.0, which the old text could not: against 0.1.0 the library still compiles, because Future<bool> satisfies a Future<void> parameter, and it is the routes test that does not, since it reads onDelete's return type. The floor is what keeps the package and its own suite resolvable together.
* chore(release): 0.0.1-alpha.26 (magic_notifications ^0.2.0) Cuts alpha.26, carrying the delete-affordance work merged in #121 and the callback answer merged in #122. Stays on the alpha rail: nothing here is a public API break in this package. _confirmThenDelete is private, so what changed for a consumer is the dependency floor, and that is what the parenthetical names. The dependency move is the point of this release. magic_notifications 0.2.0 changed NotificationsListView.onDelete to Future<bool>, and this package's default branch could not compile against it until #122 landed. Publishing this is what carries that fix to an adopter, since alpha.25 on pub.dev still pins ^0.1.0 and still returns Future<void>. Six version sites, swept by shape rather than by the old number: pubspec.yaml, CHANGELOG.md, CLAUDE.md, README.md, doc/getting-started/installation.md, and the magicStarterVersion constant behind the command banners. 1409 tests, analyze clean, format clean. There is no pubspec_overrides.yaml in this worktree, so the resolution is the one the publish workflow sees: pubspec.lock records magic_notifications 0.2.0 from pub.dev as a hosted dependency, which is the release that went out an hour ago. * chore(release): make the floor comment say what the floor says The comment above the constraint still narrated 0.1.0 as the floor while the line below it read ^0.2.0. It came in with #122 rather than with the bump, but this is the release that ships that file to pub.dev and the dependency floor is the stated point of it, so an adopter reading the published pubspec would have found the prose arguing against the constraint. Also says WHY 0.2.0 rather than 0.1.0, which the old text could not: against 0.1.0 the library still compiles, because Future<bool> satisfies a Future<void> parameter, and it is the routes test that does not, since it reads onDelete's return type. The floor is what keeps the package and its own suite resolvable together.
Draft, and it stays a draft until
magic_notifications 0.2.0is on pub. CI resolves that package from pub rather than from the sibling checkout, sopub getcannot satisfy the^0.2.0pin this PR needs and every job will fail until the release lands. Companion to fluttersdk/magic_notifications#22.What
NotificationsListView.onDeletebecomesFuture<bool>in magic_notifications 0.2.0, so_confirmThenDeletenow reports its decision:falsewhen it refuses, for either reason: no navigator to put the question in, or somebody said no.trueafter a delete the server accepted.Why the signature changed at all
The list reloads its page after a real delete, and it has to: a row leaving page one pulls one up from page two, and only the server knows which. With no result to read, the row reloaded after every tap.
Which means the confirmation dialog this package added in the same Unreleased block was costing a full
GET /notificationsevery single time somebody declined it, on a list that had not changed. That is the defect this closes, and it is one this package introduced.Nothing about the dialog itself changes.
Verification
flutter test: 1409 passeddart analyze: no issuesdart format --output=none --set-exit-if-changed lib test: 0 of 329 changeda declined delete answers false and sends nothingtaps Cancel and asserts both thefalseand that no DELETE was sent.false(answeringtruethere would reload for a delete that never happened), and the confirmed branch has to answertrue.trueturns exactly the new case red.Local resolution used a redirected
pubspec_overrides.yamlpointing at the magic_notifications branch; that file is gitignored and is not part of this PR.Merge order
Author: Anılcan Çakır anilcan.cakir@gmail.com