iOS: `clearWidget` and logout keep the per-instance ETag and status of configurable widgets

Đang mở
#398 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, ios, kotlin, react-native, swift, typescript
Lĩnh vực
cli, mobile-dev

Hướng nghiên cứu

Start in packages/ios-client/ios/app/VoltraWidgetService.swift at clearFetchedState and clearWidgetServerState, where status and ETag are cleared only for WidgetScope.of(widgetId). Use DynamicWidgetPropsStore.instanceKeys(for:) in packages/ios-client/ios/shared/DynamicWidgetPropsStore.swift to read the instance keys before clearing props, then clear each instance's status and ETag, following the Android WidgetServerUpdateCoordinator.kt pattern. Done when a logout or clearWidget leaves no instance ETag or serverUpdate status behind, and DynamicWidgetServerUpdateRunner.swift no longer sends a stale If-None-Match.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Found while fixing #381, by reading the code. Not reproduced on a device yet.

What happens

On iOS, clearing a server-driven Dynamic Widget clears the ETag and the env.serverUpdate status of the widget scope only. A widget with configuration parameters fetches per instance (ADR 0007), and each instance has its own ETag and status record. Those stay behind:

So after a logout, an instance's next fetch still sends the old If-None-Match. If the server answers 304, the runner records a success without committing props, and the instance shows {} until the server's data changes. Its env.serverUpdate also keeps the old status instead of going back to never.
https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/ios-client/ios/shared/DynamicWidgetServerUpdate/DynamicWidgetServerUpdateRunner.swift#L99-L100

Expected

The same as Android, which reads the instance keys before clearing the props, then clears each instance's status and ETag too:

DynamicWidgetPropsStore.instanceKeys(for:) already exists on iOS for this.
https://github.com/callstackincubator/voltra/blob/cee9f6739e256c4b8885207373823deb48525b1c/packages/ios-client/ios/shared/DynamicWidgetPropsStore.swift#L90

Ngôn ngữ chính
TypeScript
Star
865
Fork
50
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstackincubator/voltra

Tất cả issue của callstackincubator/voltra

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.