Add Deck browsing feature with controller, UI, routing, and format helpers - #52
Add Deck browsing feature with controller, UI, routing, and format helpers#52ercmine wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f315b81b8b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _telemetryRepository().then((repo) async { | ||
| repo.enqueue(state.sessionId, event); | ||
| await repo.flush(state.sessionId); |
There was a problem hiding this comment.
Serialize telemetry flushes per session
_enqueueTelemetry starts a new async flush for every event without waiting for prior flushes, so fast interactions (e.g., opening a card then swiping repeatedly) can run multiple TelemetryRepository.flush calls against the same queue concurrently. flush mutates a shared list after an await, so overlapping calls can remove overlapping ranges and either throw (from removeRange) or drop/duplicate telemetry batches; this needs per-session serialization or a single background drain loop.
Useful? React with 👍 / 👎.
| state = state.copyWith( | ||
| isLoadingInitial: true, | ||
| plans: const [], | ||
| nextCursor: null, | ||
| errorMessage: null, |
There was a problem hiding this comment.
Reset swipe history when starting a deck refresh
refresh() clears the visible plans but keeps prior undoStack/shownPlanIds, so after a user has swiped cards and taps retry/refresh, undo can reinsert stale cards from the previous deck into the newly fetched results and telemetry positions continue from old history. Clearing deck content should also clear swipe history/state tied to the previous batch.
Useful? React with 👍 / 👎.
| nextCursor: response.nextCursor, | ||
| hasMore: response.nextCursor != null, | ||
| lastBatchMix: response.mix, | ||
| usedFallback: response.plans.isEmpty || fallbackCount >= (response.plans.length ~/ 2), |
There was a problem hiding this comment.
Use a true 50% threshold for fallback activation
The fallback flag uses fallbackCount >= (response.plans.length ~/ 2), which floors odd lengths, so a 1-card batch marks fallback active even when fallbackCount is 0, and 3-card batches mark fallback active at 1 fallback card (33%). This over-reports fallback mode and shows misleading UI state for normal batches.
Useful? React with 👍 / 👎.
Motivation
Description
deck_state.dart), controller (deck_controller.dart) with telemetry, location and repository integration, and a new route at/sessions/:id/deckwired intorouter.dartandsession_page.dart.deck_page.dartand a set of widgets for cards and details (deck_card.dart,deck_card_skeleton.dart,deck_actions_bar.dart,card_details_sheet.dart, and several small badges/pills), and hooked link launching into existinglinkLauncherProviderusage.deckControllerProviderinproviders/app_providers.dart, added format helpers incore/format/formatters.dart, and updatedpubspec.yamlto includeflutter_card_swiper,cached_network_image, andcollectiondependencies.Testing
flutter analyzeto ensure static analysis and imports are correct and it completed successfully.flutter testand unit/widget tests completed successfully (no failing tests).Codex Task