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

113 commits

Author SHA1 Message Date
Arana Jhonny bc47aac8f4 Fixed some problems with standard (#1331) 2017-03-02 22:46:16 +01:00
Arunoda Susiripala 46b5d6a445 Fire the route cancel event only when needed. (#1316)
Earlier we do it for every route change.
2017-02-28 19:59:19 +01:00
Arunoda Susiripala 96fca5e2ad Add better hash URL support. (#1250)
* Add better hash URL support.
1. Add scrolling to given id related to hash
2. Hash changes won't trigger getInitialProps

* Add some comments.

* Fix tests.

* Add some test cases.
2017-02-28 09:31:17 -08:00
Arunoda Susiripala 818cd63ee9 Fire the route cancelled error right away. (#1312)
Earlier it wait until the JSON page is fetched.
But that's wrong and it affects when using libs like NProgress.
2017-02-28 09:48:40 +01:00
Tim Neutkens 01fa65d4a2 Unregister old serviceworker code (#1304)
Bring back 1b9e8771ec with a check for the prefetch serviceworker + if it is supported by the browser
2017-02-27 11:15:39 -08:00
Tim Neutkens f8f90955c5 Add prefetch to propTypes + flow typings (#1295) 2017-02-27 10:50:28 +05:30
Arunoda Susiripala d3b1ead149 Implement "on demand entries" (#1111)
* Add a plan for dynamic entry middleware.

* Use dynamic pages middleware to load pages in dev.

* Add the first version of middleware but not tested.

* Integrated.

* Disable prefetching in development.
Otherwise it'll discard the use of dynamic-entries.

* Build custom document and error always.

* Refactor code base.

* Change branding as on-demand entries.

* Fix tests.

* Add a client side pinger for on-demand-entries.

* Dispose inactive entries.

* Add proper logs.

* Update grammer changes.

* Add integration tests for ondemand entries.

* Improve ondemand entry disposing logic.

* Try to improve testing.

*  Make sure entries are not getting disposed in basic integration tests.

* Resolve conflicts.

* Fix tests.

* Fix issue when running Router.onRouteChangeComplete

* Simplify state management.

* Make sure we don't dispose the last active page.

* Reload invalid pages detected with the client side ping.

* Improve the pinger code.

* Touch the first page to speed up the future rebuild times.

* Add Websockets based pinger.

* Revert "Add Websockets based pinger."

This reverts commit f706a49a3d886d0231259b7a1fded750ced2e48f.

* Do not send requests per every route change.

* Make sure we are completing the middleware request always.

* Make sure test pages are prebuilt.
2017-02-26 11:45:16 -08:00
Tim Neutkens 408633c1dc Remove traces of glamor (#1286)
* Remove traces of glamor

As talked about with @rauchg. Glamor takes up around 60KB of the bundle (pre-gzip). Since styled-jsx is the way to go now and we support adding glamor by the user we should remove it as dependency cause it is bundled even when not used.

Added rehydration to the example, since we did that in our code.

There is only one thing I'm not sure about and want to discuss:
what should we do with next/css. Right now I added a throw for when it is imported. I'm not sure if we should do that / some other way to notify the user it has been removed. The reasoning behind the throw is that when we would do a console.warn the user would see 'css.default.<X>' not found because we don't have the glamor dependency anymore.

* Update yarn.lock

* Remove test for styles
2017-02-26 17:58:00 +05:30
Guillermo Rauch 1417f3040b ponify (#1278) 2017-02-25 19:41:17 -08:00
Guillermo Rauch e7c85e0162 Revert "Remove unfetch because of production build errors. (#1288)"
This reverts commit 756a32aefd.
2017-02-25 19:28:24 -08:00
Arunoda Susiripala 756a32aefd Remove unfetch because of production build errors. (#1288)
See https://github.com/zeit/next.js/pull/1278#issuecomment-282528628
2017-02-26 08:26:55 +05:30
Dan Zajdband 216efa526b Using developit/unfetch as the Fetch API polyfill (#1278) 2017-02-25 15:49:27 -03:00
Shawn Kelly 7d4d709587 fix: cmd+click Links (#1233)
Check currentTarget is 'A', not target. This is important when an anchor tag wraps another dom node.
2017-02-21 10:08:54 -08:00
Arunoda Susiripala 0bd250f4aa Handle BUILD_ID mismatch error (#1224)
* Reload the page if the buildIds are mismatch.

* Reload the browser with main.js and commons.js buildId mismatch.

* Implement proper reloading with an API to persist the state.

* Add some tests for force reload.

* Change _reload to _forceReload.

* Add a section about reload hooks to the README.

* Allow to add a hook to handle BUILD_ID mismatch.

* Remove readme docs.

* Do not show a custom error to the user.

* Cancel the routing when there's a BUILD_ID mismatch.

* Fix a typo.

* Passing route to SingletonRouter.onBuildIdMismatch

* Handle buildId mismatch automatically.
2017-02-20 15:48:17 -08:00
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