hplush / slowreader

Web app to combine feeds from social networks and RSS and to help read more meaningful and deep content
https://dev.slowreader.app
GNU Affero General Public License v3.0
160 stars 38 forks source link

Add candidate to preview URL #208

Closed ilyatitovich closed 5 months ago

ilyatitovich commented 5 months ago

Fixes #201

I would like to discuss this. Maybe we can improve the code and logic.

Checklist

ilyatitovich commented 5 months ago

Changed 'title' to 'url' for candidate.

ai commented 5 months ago

Try to reload page when some candidate is selected, you will get 404 (you can use staging or call pnpm production in web/).

But everything works without candidate in URL.

We use this script to generate web/routes.regexp and then we are injecting it into nginx config.

ilyatitovich commented 5 months ago

Updated pathRouter for handling page reload and avoiding 404 page.

ai commented 5 months ago

Updated pathRouter for handling page reload and avoiding 404 page.

But when I press Reload, the candidate valuer changes.

  1. Open Add
  2. Enter github.blog
  3. Slow Reader will find 2 feeds: Comments for … and GitHub Blog. The Comments are selected by default.
  4. Click on GitHub Blog
  5. Reload the page.
  6. The comments are selected, not the GitHub Blog.

And during the refresh I see how ?candidate= is removed and set again.

ilyatitovich commented 5 months ago

I think this happens because when we reload the page, setPreviewUrl() and other processes are ran. Maybe it’s worth providing a cache for the current candidate, for example, in localStore? We can update it when user type the different URL and clear when user moved to another route from add route.

ai commented 5 months ago

Maybe it’s worth providing a cache for the current candidate, for example, in localStore

No, user can open multiple tabs with different URL.

The better is to change setPreviewURL() logic. For instance, we can not to auto-set candidate if there is something different in router.

ilyatitovich commented 5 months ago

Changed logic for auto showing candidate on wide screen.

ai commented 5 months ago

Thanks! It was much more complex task that we thought in the beginning.