get full ticket probably doesn't return different responses for the same id. Assuming this, we can safely poll status and messages more frequently
What changed, and why it matters
This commit changes how often the app checks for updates on a support ticket and skips re-downloading the full ticket details when the app already has them. It is a routine performance and responsiveness improvement, not a security fix. There is no indication it addresses a vulnerability.
No security action required. Treat as a normal performance/refactoring change during code review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch reduces the base polling interval for ShopInBit ticket status and messages from 30 seconds to 5 seconds. It also avoids calling client.getTicketFull() when an existing ticket object is already present, passing null for the full ticket to the hydration/patch helpers instead. This is an optimization to reduce redundant network traffic and improve UI freshness. No security defect is described or evident in the diff.
Changed components
lib/pages/shopinbit/shopinbit_ticket_detail.dartlib/services/shopinbit/shopinbit_service.dartInspect captured patch +9 / −8
diff --git a/lib/pages/shopinbit/shopinbit_ticket_detail.dart b/lib/pages/shopinbit/shopinbit_ticket_detail.dart
index 9f5126a..108edbb 100644
--- a/lib/pages/shopinbit/shopinbit_ticket_detail.dart
+++ b/lib/pages/shopinbit/shopinbit_ticket_detail.dart
@@ -53,7 +53,7 @@ class _ShopInBitTicketDetailState extends ConsumerState<ShopInBitTicketDetail>
late final TextEditingController _messageController;
late final ShopInBitService _shopinBitService;
- static const Duration _kBasePollInterval = Duration(seconds: 30);
+ static const Duration _kBasePollInterval = Duration(seconds: 5);
static const Duration _kMaxPollInterval = Duration(seconds: 120);
Duration _pollInterval = _kBasePollInterval;
@@ -272,15 +272,14 @@ class _ShopInBitTicketDetailState extends ConsumerState<ShopInBitTicketDetail>
Future<void> _pushOfferView() async {
if (_id != 0) {
await showLoading(
- whileFutureAlt: () =>
- ref.read(pShopinBitService).refreshOne(widget.apiTicketId),
+ whileFutureAlt: _refresh,
context: context,
message: "Checking offer...",
rootNavigator: Util.isDesktop,
delay: const Duration(seconds: 1),
onException: (e) {
Logging.instance.w(
- "Failed to refresh ShopInBit offer ${widget.apiTicketId}, "
+ "Failed to refresh ShopInBit offer $_id, "
"using cached data",
error: e,
);
diff --git a/lib/services/shopinbit/shopinbit_service.dart b/lib/services/shopinbit/shopinbit_service.dart
index 8ed057f..09f6d73 100644
--- a/lib/services/shopinbit/shopinbit_service.dart
+++ b/lib/services/shopinbit/shopinbit_service.dart
@@ -195,10 +195,12 @@ class ShopInBitService {
"Ignoring ticket.",
);
} else {
- final ApiResponse<TicketFull> fullResp;
+ final ApiResponse<TicketFull>? fullResp;
final ApiResponse<List<TicketMessage>> messagesResp;
(fullResp, messagesResp) = await (
- client.getTicketFull(id, customerKey: customerKey),
+ existing == null
+ ? client.getTicketFull(id, customerKey: customerKey)
+ : (() async => null)(),
client.getMessages(id, customerKey: customerKey),
).wait;
@@ -206,14 +208,14 @@ class ShopInBitService {
await _insertHydrated(
ref: ref,
customerKey: customerKey,
- full: fullResp.value,
+ full: fullResp?.value,
status: statusResp.value,
messages: messagesResp.value,
);
} else {
await _patchExisting(
existing: existing,
- full: fullResp.value,
+ full: fullResp?.value,
status: statusResp.value,
messages: messagesResp.value,
);
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.