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 48f77e30e0
commit fe7c19408b

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) {