unisonweb/codebase-ui

The `/getDefinition` API should prefer the name with which it was queried

hojberg opened this issue · 1 comments

Problem

Currently base definition on Unison Share is named after a fork of base in a contributors namespace.

Examples

Screen Shot 2021-10-16 at 13 41 46

Screen Shot 2021-10-18 at 16 21 09

Proposed solution

When finding a definition via the /getDefinition API and there are multiple names:

  • If queried with a Hash, the shortest FQN should be selected
  • If queried with a name, prefer that name
  • If queried with an ambiguous name, prefer the shortest

This change could be done by updating this function to take a queried FQN argument: https://github.com/unisonweb/codebase-ui/blob/main/src/Definition/Info.elm#L36

The frontend has all the knowledge to do this correctly. Going to move the ticket to the codebase-ui repo.