Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Improve address picker for rooms #1589

Merged
merged 2 commits into from
Nov 8, 2017

Conversation

lukebarnard1
Copy link
Contributor

@lukebarnard1 lukebarnard1 commented Nov 8, 2017

  • Do not search through room topics
  • Rank rooms with shorter matching aliases first

fixes element-hq/element-web#5525

@ara4n
Copy link
Member

ara4n commented Nov 8, 2017

the code looks very plausible, and if it works (i.e. makes #matrix-architecture return #matrix-architecture rather than #matrix-dev) then \o/ :D My only slight eyebrow raise is whether Infinity actually behaves correctly in JS; it feels like a recent addition which might have batshit crazy properties, it being JS and all - i'd have been tempted to use Number.MAX_SAFE_INTEGER, so you know you're getting something of the right type and shape rather than hitting weird stringification/float/int quirks. But in practice, if it's working okay, i'm happy with it.

@ara4n
Copy link
Member

ara4n commented Nov 8, 2017

(tl;dr: lgtm)

@lukebarnard1
Copy link
Contributor Author

lukebarnard1 commented Nov 8, 2017

My only slight eyebrow raise is whether Infinity actually behaves correctly in JS;

It's a global variable, given the value +∞, which in the spec seems to behave as you'd expect.

it feels like a recent addition which might have batshit crazy properties

It was defined in ECMA-262, 1st edition ;)

i'd have been tempted to use Number.MAX_SAFE_INTEGER

According to the (much more recent) spec, this is the maximum Number n where both n and n + 1 can be represented safely, which isn't important for purposes of comparison.

I think the paranoia here is valid though, and that was a very informative trip through the ECMA spec for me 😀

@lukebarnard1 lukebarnard1 merged commit 7075931 into develop Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants