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

Fastboot initial title render #45

Open
kellyselden opened this issue Aug 16, 2016 · 7 comments
Open

Fastboot initial title render #45

kellyselden opened this issue Aug 16, 2016 · 7 comments

Comments

@kellyselden
Copy link

A repost of #43. The title in the html payload is the initial state and not the final state.

@mike183
Copy link

mike183 commented Feb 26, 2017

Is it known what work is required to get this working? Currently I think this issue is preventing the add-on from working correctly when used with ember-cli-staticboot with the includeClientScripts option disabled.

@kimroen
Copy link
Owner

kimroen commented Mar 26, 2017

Is it known what work is required to get this working? Currently I think this issue is preventing the add-on from working correctly when used with ember-cli-staticboot with the includeClientScripts option disabled.

I don't think so. If you'd like to investigate, then please feel free to do so and share any findings here ❤️

@mminkoff
Copy link

mminkoff commented Nov 20, 2017

I don't feel quite sure enough about how best to fix this but I believe I've identified the problem.

In document-title.js, collectTitleTokens ultimately calls setTitle when it reaches a route with title set. However, it calls the router's setTitle, which is set when Router is reopened lower down in that module, not the route's setTitle. I added

  if(self.setTitle && typeof self.setTitle === 'function') {
    self.setTitle(finalTitle);
  }

right before the call to self.router.setTitle and it solved the problem, though perhaps there's some better option? Please advise and I'll be happy to submit a pull request.

@Ravenstine
Copy link

@mminkoff I tried implementing what you did on my own fork but it did not appear to make a difference. Does this look correct to you?

https://github.com/Ravenstine/ember-cli-document-title/commit/7d5160b488d4e7886730acf19cb77a5f22c67a2f

I don't want to go down the more primitive root of using ember-cli-head.

@mminkoff
Copy link

That's correct @Ravenstine but yes it does depend on also using ember-cli-head (and adding setTitle to your route which then sets the title on the headData service.

If you don't use ember-cli-head then perhaps you'd have to use the method they use to affect what's in the head - the -in-element helper/component, which seems to be private/undocumented. See here: https://github.com/ronco/ember-cli-head/blob/master/addon/templates/components/head-layout.hbs

@Ravenstine
Copy link

@mminkoff Confirmed to work when using ember-cli-head. You have no idea how much time you've saved me.

@mminkoff
Copy link

mminkoff commented Dec 6, 2017

@Ravenstine So glad to hear it!! You have no idea how much time it took me to figure it out. :-)

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

5 participants