-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement route history further. Add support for html5 history. #14
base: routing-refactor
Are you sure you want to change the base?
Conversation
(defn install-history! [history-impl] | ||
(reset! history history-impl)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this the to route-history NS. Allows others to create custom implementations of the route history if they choose to.
@@ -144,9 +135,10 @@ | |||
(when (gobj/getValueByKeys evt "state") | |||
(let [event-uid (gobj/getValueByKeys evt "state" "uid")] | |||
(log/debug "Got pop state event." evt) | |||
(scf/send! app :com.fulcrologic.statecharts.integration.fulcro.ui-routes/session | |||
(swap! (:current-uid history) (constantly event-uid)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensures current-uid is synced with the browser popstate event-uid.
(-back! [this] | ||
#?(:cljs | ||
(do | ||
(tap> "Going back") | ||
(cond | ||
(> (count @uid->history) 1) (do | ||
(tap> "Going back YAW!") | ||
(log/debug "Back to prior route" (some-> @uid->history last second)) | ||
(.back js/history)) | ||
:else (log/error "No prior route. Ignoring BACK request."))))) | ||
(-current-route [this] (url->route fulcro-app)) | ||
(-recent-history [this] @uid->history)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented back to sync the browser back button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@awkay I have several changes here for your review. So far these changes syncs up nicely with the browser popstate (back/forward), and drops the user into the appropriate state route from the current URL.
Still broken:
- Reloading form edit breaks the form. We need to sync the sc route param some how.
- Report controls do not update the sc route param
So, you've tested that a ui state that had data (from the initial event) and is properly re-started with the same event data? Is that seeming sufficient? I assume that as long as the route state itself is established from outside properly, then any substate that needs to be established will be properly handled by the entry handlers from there. See any edge cases? |
No description provided.