unisonweb/codebase-ui

URLs fail to work when opening a definition from one namespace and changing perspective to another

hojberg opened this issue · 3 comments

The current way we lookup names mean that names from a namespace thats not the current perspective can't be loaded.

To reproduce:

  1. Expand unison.base.List in the sidebar
  2. Click on map
  3. Change perspective to unison.http
  4. Refresh the screen and notice an error on the page

Note that urls with a definition hash always work regardless of the perspective.

Reported by @runarorama

Possible fixes:

  1. Remove all open definitions if a perspective is set (this seems very harsh and jarring)
  2. Keep definitions from other namespaces around, but don't support them in the URL (this seems not great for sharing definitions)
  3. When changing perspective, change all open definitions that are not in that perspective to be hash based (do we always have the hash?).

3 seems like the best option to me right now. We'd likely want to do something like this anyway to give things better names as perspectives change. The big open question is whether or not we reload all those open definitions with the new context to re-render their source (this could mean a bunch of names jumping around on screen and be kinda jarring).

@pchiusano @runarorama thoughts on the above?

What I really wanted to do was get the URL for the namespace I was changing perspective to, so I was really looking for option 1.