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 03d6d6f676
commit 163e52319a

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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (isLoading && widget.posts == null) { if (isLoading && widget.posts == null) {