fix(swift-sdk): fix transaction list view not showing new transactions#3574
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTransactionListView now queries ChangesTransaction List Query Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
|
🕓 Ready for review (commit 0af4acd) |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift (1)
33-50: ⚡ Quick winMaterialize the derived transaction list once per render.
transactionsis rebuilt for the empty-state branch and then rebuilt again forList, so every update walks, dedupes, and sorts the samewalletTxostwice. Caching it once inbodykeeps behavior unchanged and halves that work.♻️ Proposed refactor
var body: some View { + let visibleTransactions = transactions ZStack { - if transactions.isEmpty { + if visibleTransactions.isEmpty { emptyStateView } else { - transactionsList + transactionsList(visibleTransactions) } } .navigationTitle("Transactions") .navigationBarTitleDisplayMode(.inline) .sheet(item: $selectedTransaction) { transaction in @@ - private var transactionsList: some View { + private func transactionsList(_ transactions: [PersistentTransaction]) -> some View { List(transactions) { transaction in Button { selectedTransaction = transaction } label: { TransactionRowView(transaction: transaction)Also applies to: 53-59, 86-96
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`:
- Around line 21-22: The TransactionListView currently defines an unscoped
reactive query `@Query` private var transactionObservation:
[PersistentTransaction], which subscribes to all PersistentTransaction records
and breaks wallet isolation; add a walletId property to the
PersistentTransaction model (matching how PersistentTxo stores walletId) and
update the TransactionListView query to include a predicate that filters
PersistentTransaction by the current wallet's id (same walletId used by
walletTxos) so the view only observes transactions for that wallet, or
alternatively replace the global `@Query` with a wallet-scoped observer API that
fetches and watches PersistentTransaction rows filtered by walletId.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8cec3cde-8e36-43ec-9d20-788ca44ecda8
📒 Files selected for processing (1)
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
|
✅ DashSDKFFI.xcframework built for this PR.
SwiftPM (host the zip at a stable URL, then use): .binaryTarget(
name: "DashSDKFFI",
url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
checksum: "9eb7327a5ebd66f7de55c9477f56a6eebe1517fccb1cd1dc3a509f05b630a0eb"
)Xcode manual integration:
|
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
Bug Fixes
Style