🏠 back to Observable

Bug: Collections order ignores non-letter characters

The ordering of notebooks in the collections page does not match the collections dialog. It appears that non-letter/number characters are ignored. (Originally reported here.)

Steps to reproduce

  1. Create four collections: “Test A0”, “#Test A1”, “Test#A1”, “Test A2”.
  2. Open collections dialog in notebook detail, take note of sort order.
  3. Open collections page, take note of sort order.

Expected behavior

Order of notebooks in collections page is identical to collections dialog.

Actual behavior

Notebooks in collections dialog have the following order:

  1. #Test A1”
  2. “Test A0”
  3. “Test A2”
  4. “Test#A1”

Notebooks in collections page have the following order:

  1. “Test A0”
  2. #Test A1”
  3. “Test#A1”
  4. “Test A2”

Background / scenario

I’m using characters like “#” and “:” to prefix certains “types” of collections and enforce a clustered sort order. Due to the above bug this only works for the collections dialog.

Unfortunately this is still an issue. Any chance it can be fixed?

I’ve filed issues for these. The problem is an inconsistency between the default sort order in Postgres (which through collation ignores case and punctuation) and in JavaScript (which through string.localeCompare ignores case). We should make these consistent, and I also think it would be better to ignore neither case nor punctuation, so we’ll see about that, too.

1 Like