headlines icon indicating copy to clipboard operation
headlines copied to clipboard

[Exercise] Implement refresh button event handler

Open creativcoder opened this issue 3 years ago • 3 comments

In part b, we finished headlines but left the refresh button event handler for grab.

As an exercise, it would be great to implement the refresh button event handler.

We want the following behavior:

When the refresh button is clicked, the app should momentarily render a loading screen, and then make another get request to top-headlines endpoint and re-populate the list of articles.

Feel free to reach out for queries.

creativcoder avatar Oct 19 '21 16:10 creativcoder

Hi @creativcoder, I am totally new to Rust (and hence new to egui etc too) but wanted to give this a try. I was able to do a hacky change to implement this but would like to know what would be the optimized way for the same. Here is my demo:

demo

Thank you.

harshadsabne avatar Oct 22 '21 17:10 harshadsabne

Hey that's a great start :) Thanks for trying! I can see it working as expected, but it seems to be blocked during the http fetch. If you'd like to share the branch you're working on, I can help out

creativcoder avatar Oct 23 '21 05:10 creativcoder

Hi there! I created a PR here: https://github.com/creativcoder/headlines/pull/2

harshadsabne avatar Oct 26 '21 17:10 harshadsabne