fix: reload posts when the parent widget has rebuilt on the timeline screen

This way if the service passed to us is changed we'll update our posts from it instead
of keeping the ones from the previous service.
This commit is contained in:
Bart Ribbers 2025-04-22 14:44:09 +02:00
parent 3615342c64
commit 65d27ce4a0

View file

@ -109,6 +109,15 @@ class _TimelineScreenState extends State<TimelineScreen> {
});
}
@override
void didUpdateWidget(covariant TimelineScreen oldWidget) {
super.didUpdateWidget(oldWidget);
WidgetsBinding.instance.addPostFrameCallback((_) {
unawaited(loadPosts());
});
}
@override
Widget build(BuildContext context) {
if (isLoading && widget.posts == null) {