Repository navigation
Conversation
util.isEmpty is async, so the unawaited call in the device filter check always returned a truthy Promise, making !util.isEmpty(...) always false. That short-circuited the device filter, so every playing device was shown regardless of the 'Filter by device(s)' setting. Fixes petersem#283
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #283 — "Filter by device(s) no longer filtering".
Cause
utility.isEmpty()is declaredasync, so it always returns a Promise, which is always truthy. The guard added in 3f3bab9 calls it withoutawait:!util.isEmpty(...)therefore evaluates tofalsefor every session, so the whole condition short-circuits andokToAddis never set tofalseby the device filter. Result: all devices are shown regardless of the "Filter by device(s)" setting — matching the reports that rolling back to v1.21.9 (before that commit) restores correct behaviour.Quick demonstration of the underlying behaviour:
Fix
Await the call, matching how
util.isEmptyis used everywhere else inplex.js(e.g. lines 274, 321, 736). This is the only unawaited call site in the codebase.The surrounding code is already inside an
asyncreduce callback, soawaitis valid here. The null-safety intent of the original commit is preserved: sessions with noPlayer.titlestill skip the device check instead of throwing on.toLowerCase().