-
Notifications
You must be signed in to change notification settings - Fork 28
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
(sandstorm package): Synchronize URL to Sandstorm address bar #12
Comments
@paulproteus I tried adding that script to the head of my page, however it doesn't look like it's helping. I visit one of my fullscreen notes, refresh, and I'm back at the brainstorm homepage. |
Thinking out loud: maybe what you need here is a function that reactively looks at |
https://github.com/tmeasday/meteor-router/wiki/Split-API provides something like that, but note it's not for Iron Router. It looks like maybe |
IronRouter.path seems to change reactively to what we want, except that it lags behind one route! If I'm on home, and then click manage boards. The url is then "bla.sandstorm.io/bla/home", even though it should be ".../manageBoards" instead! Tracker.autorun(function () {
var path = Router.current();
if (path) {
window.parent.postMessage({'setPath': location.pathname + location.hash}, '*');
}
}); Same goes for the It seems to work fine when using Tracker.autorun(function () {
Router.current();
Meteor.defer(function () {
window.parent.postMessage({'setPath': location.pathname + location.hash}, '*');
});
}); Problem is, I don't know why... Regardless, the above script works perfectly, and will be included in the next Brainstorm release. My meteor-fu is really rusty, as I haven't really used it for over a year.. Perhaps you can shed some light on why the above code works? @paulproteus |
I think the reason is that Perhaps you can make this work by doing:
but does |
Thanks so much for looking into this, @Azeirah ! |
@paulproteus Nope, path doesn't contain the full path. There's Router.current().originalUrl and Router.current().url. Both look like "/board/whateverboard".. |
Steps to reproduce:
/note/...
Expected behavior:
Actual behavior:
Fix:
Add something like this to the HEAD element, to synchronize the app's current URL with Sandstorm:
https://gist.github.com/paulproteus/99373ffce3c277bf6ec2
Also note - in the future, I hope Sandstorm can make this issue go away by e.g. automatically running JS like this to synchronize the location. But since it's needed right now, I thought I should alert you to it.
The text was updated successfully, but these errors were encountered: