Skip to content

Commit

Permalink
Fix #10: reloading when url contains a hash, v1.2.2
Browse files Browse the repository at this point in the history
lorensr committed Oct 6, 2016
1 parent b9b026f commit 064c1fb
Showing 4 changed files with 48 additions and 3 deletions.
32 changes: 31 additions & 1 deletion .versions
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).

[Change log file format](http://keepachangelog.com/)

## [1.2.2] - 2016-10-05
### Fixed

- Fix reloading when url contains a hash ([#10](https://github.com/jamielob/reloader/issues/10))

## [1.2.0] - 2016-04-26
### Added
- `launchScreenDelay` option
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'jamielob:reloader',
version: '1.2.1',
version: '1.2.2',
summary: 'More control over hot code push reloading',
git: 'https://github.com/jamielob/reloader/',
documentation: 'README.md'
12 changes: 11 additions & 1 deletion reloader.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,17 @@ Reloader = {

reload() {
this.prereload()
window.location.replace(window.location.href);

// We'd like to make the browser reload the page using location.replace()
// instead of location.reload(), because this avoids validating assets
// with the server if we still have a valid cached copy. This doesn't work
// when the location contains a hash however, because that wouldn't reload
// the page and just scroll to the hash location instead.
if (window.location.hash || window.location.href.endsWith("#")) {
window.location.reload();
} else {
window.location.replace(window.location.href);
}
},


0 comments on commit 064c1fb

Please sign in to comment.