1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

99 commits

Author SHA1 Message Date
Arunoda Susiripala f4337d3072 Make sure reading the body of same JSON page request safe. (#1185)
* Make sure reading the body of same JSON page request safe.
It's not possible to read the body twice from fetch()'s response
So, we've to clone the response before doing anything.

* Fix tests.
2017-02-17 01:12:32 -03:00
Guillermo Rauch 1b9e8771ec Revert "Add a way to disable running service workers. (#1167)"
This reverts commit d8af41d690.
2017-02-16 19:35:36 -03:00
Arunoda Susiripala d8af41d690 Add a way to disable running service workers. (#1167) 2017-02-15 21:13:27 -03:00
Naoyuki Kanezawa 8e4e2e3e01 improve prefetch (#1161) 2017-02-16 00:59:42 +05:30
Arunoda Susiripala 412f9739d8 Reload the page if asked to change the current URL (#1159)
* Add support to reload the page when ask to change the same url.

* Do not run change() in the initial page load.

* Add integration tests.

* Add self-reload.js
2017-02-15 19:27:41 +01:00
Naoyuki Kanezawa 540a86f007 fix prefetch url (#1154) 2017-02-15 15:01:03 +01:00
Naoyuki Kanezawa 38d236e2b3 fix prefetching relative path (#1151) 2017-02-15 13:34:13 +01:00
Arunoda Susiripala 14c86bef1d Introduce a simple prefetching solution (#957)
* Implement a very simple prefetching solution.

* Remove next-prefetcher.

* Require 'whatwg-fetch' only in the client.

* Use xhr in the code.

* Use a simple fetching solution.

* Fix 404 and xhr status issue.

* Move the prefetching implementation to next/router.

* Add deprecated warnning for next/prefetch

* Run only 2 parellel prefetching request at a time.

* Change xhr to jsonPageRes.

* Improve the prefetching logic.

* Add unit tests covering the Router.prefetch()

* Update examples to use the new syntax.

* Update docs.

* Use execOnce() to manage warn printing.

* Remove prefetcher building from the flyfile.js
Because, we no longer use it.
2017-02-15 14:22:22 +05:30
Eric Zingeler d382e4db9a replace location.origin usage with new utils/getLocationOrigin (#1142) 2017-02-15 14:01:19 +05:30
Naoyuki Kanezawa 45e77d535f Fix status messages on error (#1131)
* fix status messages on error

* error: use the special message for 404
2017-02-14 16:15:42 +01:00
Naoyuki Kanezawa 1cd242ba57 remove gulpfile.js (#1092) 2017-02-12 17:32:45 +01:00
Naoyuki Kanezawa 9348762f4a add next/error (#1040) 2017-02-08 16:59:33 -03:00
Arunoda Susiripala 5b2854dce9 Properly handle hash URL changes. (#996)
* Properly handle hash URL changes.

* Make sure we replace origin correctly.

* Get rid of RegExp for getUrl().
2017-02-05 17:58:44 +09:00
Tim Neutkens 6431f5fce2 Allow any element to be rendered under Link (#921)
* Allow any element to be rendered under Link

* Use Children.only instead of Children.map

* Remove check for multiple children since we already throw at 2+

* Clean up variables
2017-02-03 12:27:12 -08:00
Naoyuki Kanezawa 0b3db91731 Fix handling finished response (#889)
* allows to not return props if response is already finished on getInitialProps

* check res.finished after getInitialProps call of Document
2017-01-26 16:36:50 +05:30
Arunoda Susiripala b4e2b7bd4d Handles the initial popstate event of older version of Safari. (#870) 2017-01-26 01:58:26 +09:00
Guillermo Rauch 85cd38f4bd tweak font sizes again 🙈 2017-01-21 18:12:27 -08:00
Zhao 3813f73ece Fix error fonts (#826)
* add "consolas" font for windows

* fix too small font size in non-retina display
2017-01-21 18:04:41 -08:00
Naoyuki Kanezawa 98e2951f0c Use ErrorDebug component on error of react-hot-loader (#852)
* use ErrorDebug component for reporter of react-hot-loader

* app: fix props of ErrorDebug
2017-01-21 10:46:18 -08:00
Arunoda Susiripala 399e510389 Make sure lastAppProps always have some value. (#829)
* Make sure lastAppProps always have some value.

* Revert "Make sure lastAppProps always have some value."

This reverts commit b4ae722d9c1a4460e17dbdc041b111cbd492b2aa.

* Throw an error, if we found an empty object from getInitialProps.

* Add proper tests for getInitialProps empty check.
2017-01-20 11:33:46 -08:00
Dan Zajdband 70b92e6b65 Added deprecation message when adding an extra anchor in behalf of the user. (#797) 2017-01-16 22:02:11 +01:00
Tim Neutkens 8318f5b8de Add cross browser stacktrace (#776)
* Add cross browser stacktrace

* Remove unused stack variable
2017-01-16 01:17:29 +09:00
Arunoda Susiripala fae2305f46 Add correct sync version of error handling with existSync. (#769)
* Add correct sync version of error handling with existSync.

* Update utils.js
2017-01-15 21:15:06 +09:00
Tim Neutkens 23cddda9cf Only show deprecation when using next/css (#762) 2017-01-13 14:46:21 -08:00
Tim Neutkens 3b3353f821 Revert "Dont' override glamor methods, use a new object instead (#754)" (#755)
This reverts commit 86516629cf.
2017-01-12 14:52:19 -08:00
Tim Neutkens 86516629cf Dont' override glamor methods, use a new object instead (#754) 2017-01-12 12:50:21 -08:00
Naoyuki Kanezawa 0ef28ab128 Don't discard component state on error (#741)
* render debug page as overlay

* handle errors occurrred on rendering cycle for HMR

* retrieve props if required on HMR
2017-01-11 17:58:20 -08:00
Arunoda Susiripala b7e57f9347 Implement "Immutable build artifacts" feature (#745)
* Write BUILD_ID when building.
It's a random id (uuid.v4())

* Add buildId to the core JS files.

* Add immutable cache-control header.
Only if the buildId is matched.

* Set '-' as the dev buildId always.

* Add buildId handling for JSON pages.
2017-01-11 12:16:18 -08:00
Naoyuki Kanezawa 8570d19af6 Handle errors of React lifecycle methods (#661)
* handle errors of lifecycle methods

* handle errors of render method
2017-01-05 09:27:39 -08:00
Craig Smith e38cacc4c2 Prevent prefetcher from making identical requests. (#665) 2017-01-05 19:16:20 +09:00
Arunoda Susiripala 01a17738db Reset prefetchCache when reloading a route. (#617)
* Reset prefetchCache when reloading a route.

* Prefetch again when there's a HMR reload.

* Make .send() to return a promise.
2017-01-02 20:18:14 +09:00
Naoyuki Kanezawa c1a620a7c4 Support relative urls on Link component (#614)
* link: support relative urls

* link: support protocol-relative urls

* router: fix error for clicking anchor tag
2017-01-01 22:22:07 -08:00
Naoyuki Kanezawa 897c60b4fd Fix error routes (#595)
* fix router error handlings

* respond with JSON when error occurs on JSON routes
2017-01-01 11:36:37 -08:00
Arunoda Susiripala c890dc3573 Implement Router Events (#511)
* Move route loading logic to a common place.

* Add router events.

* Add EventEmitter's core API methods.

* Add example app for loading events and docs.

* Fix some typos.

* Get rid of Router.ready()

* Remove events package.
It's already shipping with webpack.

* Handling aborting properly.

* Expose simple attribute based events listener API.
Removed the proposed event listener API from the public API.

* Remove error logged when there's an abort error.
There are many other ways to capture this error.
So, it doesn't look nice to print this always.

* Change router events to pass only the current URL as arguments.

* Add a section about Cancelled Routes to README.
2016-12-30 17:15:22 -08:00
Naoyuki Kanezawa 0f11018819 fix getInitialProps called on client on first load (#572) 2016-12-30 11:55:00 -08:00
Tim Neutkens e8985b3588 Add warning for multiple children in Link (#558)
* Add warning for multiple children in Link

* Add space after if

* Use proptype validation
2016-12-29 21:53:20 +09:00
Naoyuki Kanezawa 242758e3ee fix navigation failure (#546) 2016-12-27 21:27:52 -08:00
Naoyuki Kanezawa af2d78c042 router: register initial route (#508) 2016-12-24 09:29:23 -08:00
Dan Zajdband 01e1883f79 Added glamor example and pointing warning to css migration guide (#500) 2016-12-23 11:18:25 -08:00
Naoyuki Kanezawa 74d4d22f84 router: fix route value on popstate (#490) 2016-12-23 09:14:14 -08:00
nkzawa 6b18e34f66 link: tweak scroll condition 2016-12-22 17:17:50 +09:00
James O'Dwyer 31feced24a Avoid autoscrolling anchored URLs (#474)
* force scroll to false if # is found in url

* only overwrite scroll if scroll=true is not passed in

* clean up logic around setting scroll var
2016-12-22 17:15:49 +09:00
Naoyuki Kanezawa 2a29bf6242 display deprecation warning only when method was called (#462) 2016-12-21 10:43:31 -08:00
Arunoda Susiripala 141c045c68 Make next/router a client only API. (#443)
* Prevent using 'next/router' APIs inside 'getInitialProps'

* Remove incorrect documentation.

* Make next/router a client only API.
2016-12-20 09:27:43 -08:00
Arunoda Susiripala 565bb5790b Update url.pushTo and url.replaceTo update only on dev. (#434)
In order to warn the user, now we are using a warn function
which is located in the lib/utils module.
2016-12-19 13:04:38 -08:00
Arunoda Susiripala e45cc89ce3 Add deprecate messages for url.replaceTo and url.pushTo (#433) 2016-12-19 10:49:15 -08:00
Arunoda Susiripala 22776c2eee Implement the Singleton Router API (#429)
* Immplement the initial singleton Router.

* Use the new SingletonRouter for HMR error handling.

* Use SingletonRouter inside the Link.

* Create an example app using the Router.

* Make the url parameter optional in Router.push and Router.replace

* Add a section about next/router in the README.
2016-12-19 06:40:26 -08:00
Naoyuki Kanezawa 1e70324a41 print a deprecated message for next/css (#421) 2016-12-17 13:59:38 -08:00
Arunoda Susiripala 37a9c661ff Make prefetching works again. (#422) 2016-12-17 13:59:03 -08:00
Thomas Jaggi de6521a481 Allow for custom route in pushTo and replaceTo methods (#417) 2016-12-18 05:18:50 +09:00