-
Notifications
You must be signed in to change notification settings - Fork 4
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
autoMount and route settings order issue #158
Comments
This is a significant problem because automounted components are likely to mount with their default state which will not include the state from the URL. The following are some ways we could fix this: WAY A: Turn off mounting for selected componentscan.Component.extend({
tag: "chat-app",
view: `....`,
automount: false // this component is not automounted
});
can.route.data = document.querySelector("chat-app");
can.route.ready() //-> can-route knows how to automount with data provided. Likely something `can-view-callbacks` provides. Pros:
Cons:
WAY B: Async mountingMount all components during a requestAnimationFrame. Code stays the same: can.Component.extend({
tag: "chat-app",
view: `....`
});
can.route.data = document.querySelector("chat-app");
can.route.start(); Cons:
WAY C:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If routes are defined and used by an auto-mounted component, any setting to the
route
object need to be made before the component definition.In the following example, when the component is mounted,
route.bindings.pushstate.root
points to its default value instead of/public/
.What should we do in this case? Make
route.bindings.pushstate.root
observable so it broadcasts its value when changed?The text was updated successfully, but these errors were encountered: