From 0c27c10a2c74ed18602c22d380ed162f2eeb0b17 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 4 Jan 2026 13:03:35 +0100 Subject: [PATCH] fix(auth): defer OIDC callback processing to post-frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wraps _processCallback() in addPostFrameCallback to avoid Riverpod "Tried to modify a provider while the widget tree was building" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 6 ++++++ lib/routing/app_router.dart | 5 ++++- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 610054c..59bcbea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.9] - 2026-01-04 + +### Fixed +- Fixed OIDC callback Riverpod state modification error + - Deferred callback processing to `addPostFrameCallback` to avoid modifying state during widget build + ## [1.0.8] - 2026-01-04 ### Changed diff --git a/lib/routing/app_router.dart b/lib/routing/app_router.dart index 0e4c950..eb4a7fa 100644 --- a/lib/routing/app_router.dart +++ b/lib/routing/app_router.dart @@ -286,7 +286,10 @@ class _OidcCallbackPageState extends ConsumerState<_OidcCallbackPage> { @override void initState() { super.initState(); - _processCallback(); + // Defer callback processing to avoid Riverpod state modification during build + WidgetsBinding.instance.addPostFrameCallback((_) { + _processCallback(); + }); } Future _processCallback() async { diff --git a/pubspec.yaml b/pubspec.yaml index 3e30805..ea11c5b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.8+1 +version: 1.0.9+1 environment: sdk: ^3.10.4