Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loading indicator #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kashiashvili
Copy link

@kashiashvili kashiashvili commented Jun 2, 2024

Add spinner and text when data is being fetched #10

I'm pretty sure this markup could have been done better

div.text-center(style="display: flex; justify-content: center; position: relative;")
          button#submit(type="submit") Authorize & Backup
          span#loading.loader(style="display: none; position: absolute; left: 65%;")

@kashiashvili
Copy link
Author

I'm not sure notification about the pr have reached you so just in case @darekkay

@darekkay darekkay self-requested a review June 3, 2024 16:30
@darekkay
Copy link
Owner

darekkay commented Jun 3, 2024

Thank you for the pull request. Unfortunately, it doesn't fully solve #10 . The spinner is only visible until the /export request returns. However, the export is only finished after /download request finishes.

While the current state is bad (no loading indicator at all), I would argue that the proposal makes it worse - now users may think that once the loading spinner moves away, the download is completed - which is not true.

I've created this project 10 years ago, mostly as a learning experience. And the code shows that, making some changes quite difficult. As far as I can tell, I used window.location.replace to redirect to the /download endpoint. As the endpoint returns a file, the browser downloads the file and the code relies on native browser handling. For some reason, we don't see a native browser tab loading.

What could work (just tried it as a proof of concept) would be to replace the window.location.replace with

    await fetch(persistentBackupUrl);

and then to manually download the result.

Unfortunately, I currently don't have the time to further look into this.

@kashiashvili
Copy link
Author

@darekkay, I'm sorry for wasting your time. At the time of development, I was experiencing network issues which prevented me from downloading data from Todoist. This also made it difficult for me to detect the early disappearance of the spinner, as network errors consistently resulted in an error page.

Thanks for the suggestions. Now it's done and tested.

@darekkay
Copy link
Owner

@kashiashvili No problem, no time wasted. I just don't put much priority on this project in general. I had finally a look into your latest changes and it seems to cause a new regression: not all data is exported when selecting JSON + "all data". On the main branch, all data is exported (for me 18 MB); with your change, it seems to break the export too early (only 602 kB for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants