Skip to content

Conversation

@antonnyst
Copy link
Contributor

Implemented 'as loaded' search by quite simply not sorting the results.

Resolves #933

I have only tested this with a single source of Spotify, so might be an good idea to test with multiple different sources to make sure it works before merging.

more: 'All playlists (%{count})'
tracks:
title: Tracks
asloaded: 'As loaded'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to create a new translation entry here, duplication of fields.filters.as_loaded

{ value: 'followers', label: i18n('common.popularity') },
{ value: 'artist', label: i18n('common.artist') },
{ value: 'duration', label: i18n('common.duration') },
{ value: 'asloaded', label: i18n('search.asloaded')}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a gander at the equivalent syntax for other views, for instance src/js/views/Library/Albums.jsx.

"As loaded" translates quite literally to "don't sort me!" ie sortOrder: null:

      {
        value: null,
        label: i18n('fields.filters.as_loaded'),
      }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that seems like a better way to do it!

(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
sortReverse,
);
if (sortField !== 'asloaded') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"As loaded" is null, so we would invert the logic here to if (sortField) { ... then sort

@jaedb jaedb changed the base branch from master to develop May 2, 2025 00:53
@jaedb jaedb merged commit 0690e9f into jaedb:develop May 2, 2025
@antonnyst antonnyst deleted the asloaded branch June 4, 2025 16:23
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.

Search results "as loaded" ordering

2 participants