Builditluc / wiki-tui

A simple and easy to use Wikipedia Text User Interface
https://wiki-tui.net/
MIT License
416 stars 14 forks source link

[BUG] Global language change affects completed search result #206

Closed non-descriptive closed 1 year ago

non-descriptive commented 1 year ago

General Information Version: 0.8.1 @ 715f28cb Installation Method: cargo

Describe the bug Attempting to open completed search result after switching global wiki language makes either error or opening some random wiki page.

To Reproduce

  1. Input asd in search bar
  2. Hit Enter - search result will pop up image
  3. Hit F2 and change language to Russian
  4. Navigate to 'Autism spectrum` and hit Enter- will yield error "Failed to fetch"
  5. Navigate to ASD result and hit Enter - will open this page instead of this

Expected behavior I guess best solution to send event to the search window to re-trigger search and re-render search results and info's on global language change. As alternate solution - remove search window completely from windows stack so when we leave article(s) it will get back directly to main window, not search results.

Screenshots If applicable, add screenshots to help explain your problem.

Log wiki-tui.log

Additional context related to #178/PR #191

Builditluc commented 1 year ago

Hey @non-descriptive! Thank you for your bug report. I've already reproduced your error. I'm going to fix and release this asap!

Builditluc commented 1 year ago

This is going to take a bit longer than expected because I have to do the same thing for the search results as I did with the article links (not as long tho because I can reuse some of the code)

Builditluc commented 1 year ago

Hey @non-descriptive! I've uploaded a patch for this issue in the fix-invalid-search-links branch. Would you mind taking a quick look at it to see if it fixes the issue for you aswell?

The logic is the same as with opened articles, meaning that already completed searches will remain in their language (and when you open a search result, the opened article will be in the searched language). If you want to search for the same thing in the new language, you'll have to make a new search.

non-descriptive commented 1 year ago

Works fine.