Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
0.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MoOx committed Nov 24, 2016
1 parent f2b8f5b commit df4a5ed
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# 0.19.3 - 2016-11-21
# 0.19.4 - 2016-11-24

- 🐛 Fixed: click on anchors are now scrolling has expected
([#665](https://github.com/MoOx/phenomic/issues/665) - @MoOx)

# 0.19.3 - 2016-11-22

🍭 This bugfixes are a good thing and have been detected since we use 2
different Phenomic projects for our documentation website:
Expand All @@ -22,16 +27,16 @@ We might revisit this issue when refactoring how collection is handled and
rendered.
(@MoOx)

🐛 Fixed: when a ``<Link>`` explicitly receive an absolute url from the same
- 🐛 Fixed: when a ``<Link>`` explicitly receive an absolute url from the same
domain, but not the same project base path, a normal ``<a>`` is rendered
(@MoOx)

# 0.19.2 - 2016-11-21
# 0.19.2 - 2016-11-22

**broken**: npm published a incomplete package which resulted in an error during
installation: ``Cannot find module '...phenomic/npm/postinstall.js'``

# 0.19.1 - 2016-11-21
# 0.19.1 - 2016-11-22

- 🐛 Fixed: static build does not write phenomic assets as if they were handled by react-helmet.
This fix the issue where phenomic CSS are removed from the page when
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phenomic",
"version": "0.19.3",
"version": "0.19.4",
"description": "Modern website generator based on the React and Webpack ecosystem.",
"keywords": [
"react",
Expand Down
14 changes: 9 additions & 5 deletions src/client/should-update-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ type RouterPropsType = {
}
}

// we skip scroll update if only hash changes
// only scroll when complete url changes
// (except for hash change - this example provide a natural feeling when you
// use simple link to internal anchor (eg: a table of content that use hashes
// inside a page))
const shouldUpdateScroll =
(prevProps: RouterPropsType | null, props: RouterPropsType): boolean => {
if (prevProps) {
const prev = prevProps.location
const curr = props.location
// if "page" is the same we don't scroll
if (prev.pathname + prev.search === curr.pathname + curr.search) {
// except if hash is empty, because it should scroll if
// - same url, without hash
// - hash to no hash
// both cases are kind of a "back to top"
// except if hash is empty, because it should keep browser natural
// behavior if:
// - same url, without considering the hash
// - previous url contains a hash to an new url does not
// both cases are kind of a "back to top" scenario
if (curr.hash === "") {
return true
}
Expand Down

0 comments on commit df4a5ed

Please sign in to comment.