Skip to content

Commit

Permalink
Ensuring we only sort urls in dropdown once
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Jul 21, 2024
1 parent 2d75788 commit cf164c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

.PHONY: test
test:
$(run) pytest --cov-report term-missing --cov=posting tests/ -vv -n 16 -m "not serial"
$(run) pytest --cov=posting tests/ -vv -n 16 -m "not serial"
$(run) pytest --cov-report term-missing --cov-append --cov=posting tests/ -vv -m serial

test-snapshot-update:
$(run) pytest --cov-report term-missing --cov=posting tests/ -vv -n 16 -m "not serial" --snapshot-update
$(run) pytest --cov=posting tests/ -vv -n 16 -m "not serial" --snapshot-update
$(run) pytest --cov-report term-missing --cov-append --cov=posting tests/ -vv -m serial --snapshot-update
2 changes: 1 addition & 1 deletion src/posting/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def on_request_cache_updated(
self, event: CollectionTree.RequestCacheUpdated
) -> None:
"""Update the autocomplete suggestions when the request cache is updated."""
self.url_bar.cached_base_urls = event.cached_base_urls
self.url_bar.cached_base_urls = sorted(event.cached_base_urls)

async def action_send_request(self) -> None:
"""Send the request."""
Expand Down
2 changes: 1 addition & 1 deletion src/posting/widgets/collection/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def get_base_url(url: str) -> str | None:
# TODO: We should sort these cached URLs on frequency instead
# of alphabetically. Bring the most used URLs to the top.
self.RequestCacheUpdated(
cached_base_urls=sorted(self.cached_base_urls),
cached_base_urls=list(self.cached_base_urls),
tree=self,
)
)
Expand Down

0 comments on commit cf164c8

Please sign in to comment.