nubank/workspaces

Support url params to open specific workspaces

Closed this issue · 1 comments

Support url params to open specific workspaces

I opened a PR with a solution for the issue #54, though I think it would be nice to discuss this solution before merging the PR.

Problem statement

We can't open a specific saved workspace through the URL.

Non goals

We don't want to consider local workspaces in the solution space. Local workspaces are the one that exist only in the developer's machine.

Solution 1: Query Parameters

Open a workspace through a query parameter in the url. Example workspaces.html?ws=some-worspace-name

Allows for a very small solution. With just a few lines we are able to open the ws and we don't require any other lib to do so.

Disadvantages: the URL doesn't reflect the state of the interface, we just use the query parameter to open the initial ws, but after changing workspaces (by clicking on another tab for example) the URL is note update. We can clean the query parameter, but the state current ws is not represented in the URL anymore.

Solution 2: Use a proper router

With a router like secretary we could use hash # prefixed routes and let the route dispatch function to open the desired workspace. Example: workspaces.html/#/some-workspace-name

Disadvantages: This solution requires more code because we would like to have the tab and menu links to update the URL and use the router to update the interface calling the open-workspace fulcro mutation. This solution also has the problem of the need to import another library (like secretary) that may conflict with user existing ones.

ping @wilkerlucio