rrousselGit / riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
https://riverpod.dev
MIT License
5.82k stars 888 forks source link

ref.invalidate() does not make another request to the server #3472

Closed jasonkang14 closed 1 month ago

jasonkang14 commented 1 month ago

Describe the bug I am building a web service with Flutter && riverpod. When ref.invalidate(PROVIDER) is called, I cannot see the new GET request to the server in the network tab

To Reproduce

onPressed: () async {
    final todoNotifier = ref.read(todoProvider.notifier);
    await todoNotifier.createTask({
        'title': title,
        'description': description,
    });
    ref.invalidate(todoProvider);
}

Expected behavior The FutureProvider which gets invalidated does get updated with the update data from the database. however, I cannot see whether a new GET request has been made. Is this a bug? if not could you explain this behavior?

rrousselGit commented 1 month ago

You'll have to produce a full example. As it is, I cannot know what's going on.

It could be that your provider isn't listened, so it doesn't rebuild naturally