Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Ensure Definitions are opened via Route changes #281

Merged
merged 1 commit into from
Nov 30, 2021

Conversation

hojberg
Copy link
Member

@hojberg hojberg commented Nov 30, 2021

Problem

We want the URL to be main way definitions are opened and fetched.
Previously this was an afterthought such that we fetched a definition
and then changed the URL, resulting in broken back-button behavior.

Solution

This changes how we load definitions such that a URL is changed which,
in a route handler, causes the Workspace to open and fetch that
definition, with 1 exception: when a definition is opened from another
definition, it is important that we open the new definition relative to the
originating definition (above it or below it). In this case we open the
definition, then change the URL, which subsequently tries to open the
definition again; seeing that the definition has been opened already the
fetch attempt is cancelled.

Fixes #236 and part of #195 (back button still does not work for perspectives)

We want the URL to be main way definitions are opened and fetched.
Previously this was an afterthought such that we fetched a definition
and then changed the URL, resulting in broken back-button behavior.

This changes how we load definitions such that a URL is changed which,
in a route handler, causes the Workspace to open and fetch that
definition, with 1 exception: when a definition is opened from another
definition, it is important that we open the new definition relative to the
originating definition (above it or below it). In this case we open the
definition, then change the URL, which subsequently tries to open the
definition again; seeing that the definition has been opened already the
fetch attempt is cancelled.
@hojberg hojberg force-pushed the route-driven-open-definitions branch from 494fc12 to 7bd3f81 Compare November 30, 2021 18:11
in
( { model | route = route, workspace = workspace }, Cmd.map WorkspaceMsg cmd )

_ ->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't attempt to fix route driven perspectives (later effort).

@@ -116,7 +116,7 @@ update env msg ({ workspaceItems } as model) =
in
( { model | workspaceItems = nextWorkspaceItems }
, cmd
, openDefinitionsFocusToOutMsg nextWorkspaceItems
, None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this is the FetchItemFinished pattern match)

We don't need to change the URL to the focused item after fetching anymore since we are now fetching what was in the URL.

@hojberg hojberg merged commit 0ed7e9e into main Nov 30, 2021
@hojberg hojberg deleted the route-driven-open-definitions branch November 30, 2021 18:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loading definitions from empty state doesn't show spinner
2 participants