ember-cli / ember-page-title

Page title management for Ember.js Apps
https://ember-cli.github.io/ember-page-title/
Other
188 stars 57 forks source link

Prevent page title to set to empty string #253

Open aalasolutions opened 1 year ago

aalasolutions commented 1 year ago

fix: Do not update the title if it is empty

knownasilya commented 1 year ago

@aalasolutions what was the issue you encountered?

knownasilya commented 1 year ago

Looks like prettier needs to run on the code changes

aalasolutions commented 1 year ago

@knownasilya I just used the github to edit the file on browser so lint issue.

Problem I had is I have just starting using this in an app, where afterModel is used to update the page title. That is done in whole app. I used this component on one page, but when I go to any other page which do not have page-title helper, it just removes the page title. So if a title is set in afterModel, that is removed, set to '' empty string.

So in short, willDestroy is called when I transition to any other route. which calls scheduleTitleUpdate and then _updateTitle and here empty title is being set.

Saying that, just thinking that this will prevent any one from using {{page-title ''}} not sure if any one would need that.

knownasilya commented 1 year ago

@aalasolutions could you create a reproduction repo or test in this repo? I haven't seen this issue and don't want this to break many people's apps.

aalasolutions commented 1 year ago

@knownasilya created this repo https://github.com/aalasolutions/ember-page-title-test-repo