data-skeptic / dataskeptic.com

Source code for dataskeptic.com
https://dataskeptic.com
14 stars 5 forks source link

add changePageTitle functionality #734

Open kylepolich opened 6 years ago

kylepolich commented 6 years ago

Currently we have the changePageTitle function but it's not working right. Without re-inventing the site, make the most minimal number of lines of code change to get this working.

Heartless49 commented 5 years ago

@kylepolich Looking into this issue real quick and found that the function changePageTitle is being imported in multiple files, and used, however the function itself does not exist in the file that it is being imported from, /shared/Layout/Actions/LayoutActions.js.

Digging deeper to see how the pages are actually changing their page titles on navigation, I discovered that the site actually doesn't use that function at all. Currently the page's titles are relying on a HOC, page that wraps every "page" style component, and connects that page's "meta data" to the state. If that page has a title attribute in its meta data, then that becomes the page's title.

Seeing that the pages do actually change their titles I'm not seeing an issue other than the instant when navigating from the blog listing or podcast listing page, to a post, then back. In that situation the post that was opened has its title still active.

As for why this is working this way, i'm really unsure, but with the way that this is currently setup, changePageTitle event if it was working (I already fixed it to test) will have no effect, as the page's meta data would override the redux state change caused by this function.

In conclusion, fixing the above-mentioned issue would require a decent amount of rewriting across the entire site to have more control over the page's titles.

Please let me know how you would like me to proceed.