Tencent / Tencent/tdesign-flutter

fix: 排查通知中心回调触发已销毁 State 的问题

Open
#996 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
1.2k
Forks
182
Avg merge
2d 2h
Merged PRs (30d)
88

Description

背景

示例通知中心曾记录 TNotification.postNotificationCallHandler 触发 setState() called after dispose() 的错误。当前广播中心保存回调并在事件触发时执行,若页面销毁前未解除订阅,可能继续调用已失效的 State。

期望

  • 复现并确认页面销毁后的回调生命周期问题;
  • 明确订阅方的解除订阅要求,或让通知中心提供更安全的生命周期管理方式;
  • 补充回归测试。

相关代码

  • tdesign-component/example/lib/base/notification_center.dart

该问题原先由 TODO/错误记录提示,不能仅删除注释。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading tdesign-component/example/lib/base/notification_center.dart and reproduce the callback after the page is disposed. Trace the subscription and callback lifecycle to determine whether callers must unsubscribe or the notification center should manage disposal more safely. Done means the lifecycle behavior is defined, the disposed State is not called, and a regression test covers it.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.