Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Represent current state as tree, not seq #14

Open
telekid opened this issue Aug 31, 2019 · 0 comments
Open

Represent current state as tree, not seq #14

telekid opened this issue Aug 31, 2019 · 0 comments
Milestone

Comments

@telekid
Copy link
Owner

telekid commented Aug 31, 2019

This is a big, important change. I want to create a clean separation between three different trees that exist in a modern SPA.

The view tree
This is the tree that is commonly represented by something like React, and eventually renders down to the DOM.

The route tree
This is the tree that represents the potential "route space" in an application. The branches under each node represent a selection of potential active states; for example, a tab container would be represented by a node, and individual tabs are child nodes.

The route state tree
This is what isn't correctly represented in 0.1.x. Traditional routers represent "current state" as a scalar value, which makes sense on the server side but makes no sense on the client side. 0.1.x of pine represents state as a seq representing a single path down the tree, but this is wrong too. Instead, state should be represented as a tree, to account for the fact that multiple routing branches can be active at the same time.

In order to make this work, I need to create two methods:

  • (get-route-state route-tree path), of type RouteTree -> Path -> RouteState
  • (get-route-path route-tree route-state), of type RouteTree -> RouteState -> Path
@telekid telekid added this to the 0.2.0 milestone Aug 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant