Commit graph

17 commits

Author SHA1 Message Date
Tim Neutkens
2ba352da39 Move next-server back into next package (#8613)
* Initial move

* Make emitting work

* Update paths

* Remove leftover files

* Add correct externals configuration

* Import correct path

* Update path to work with ts-server test

* Update lib directory

* Compile next-server/lib
2019-09-04 10:00:54 -04:00
Natalie Marleny
06876f1be0 fix: Warn when user specifies prefetch option as true (#8233)
* Warn when user specifies prefetch option as `true`

* Update index.test.js
2019-08-12 00:26:25 -04:00
JJ Kasper
a4889f964e
Update handling of ref in next/link (#8254) 2019-08-08 13:11:17 -05:00
JJ Kasper
8e4509caf2 Add warning for invalid href being passed to router (#8231)
* Add warning for bad href being passed to router

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Inline invalidHref for better code elimination
2019-08-07 10:47:13 -04:00
Olivier Tassinari
71f9288a54 Fix onError prop-type warning in Link (#8021)
The warning

> Warning: Failed prop type: Link: unknown props found: onError

can happen in this case:

```tsx
import * as React from 'react';
import NextLink, { LinkProps as NextLinkProps } from 'next/link';

type NextComposedProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & NextLinkProps;

const NextComposed = React.forwardRef<HTMLAnchorElement, NextComposedProps>((props, ref) => {
  const { as, href, replace, scroll, passHref, shallow, prefetch, onError, ...other } = props;

  return (
    <NextLink
      href={href}
      prefetch={prefetch}
      as={as}
      replace={replace}
      scroll={scroll}
      shallow={shallow}
      passHref={passHref}
      onError={onError}
    >
      <a ref={ref} {...other} />
    </NextLink>
  );
});
```

*Taken from Material-UI Next.js integration example*
2019-07-25 18:52:27 +00:00
JJ Kasper
4adef73ab8
Update link ref handling to clean up previous listeners (#7943) 2019-07-14 10:23:13 -07:00
Luis Fernando Alvarez D
7b25e2995e Export types for link props (#7905)
* export LinkProps

* Add test
2019-07-11 14:52:21 -04:00
Joe Haddad
b60985b2be
Revert "fix(Link): Set focus back to the body element (#7693)" (#7753)
This reverts commit defde85e81.
2019-07-04 23:24:14 -04:00
Connor Bär
defde85e81 fix(Link): Set focus back to the body element (#7693)
* fix(Link): Set focus back to the body element

* refactor(Link): Fix typings

* Update blurring logic and add tests
2019-07-04 11:30:22 -04:00
Kuba Juszczyk
2debe7fb73 Allow opting out of automatic prefetch for Link (#7532)
* Restoring not working mouse event

* Restoring possibility of conditionally switching off the prefetch
2019-06-24 11:22:27 -07:00
Kuba Juszczyk
e49f26d644 Restore onMouseEnter event (#7531) 2019-06-07 11:43:27 -04:00
Joe Haddad
b3170d2648
Format missed files (#7464)
* Format missed files

* Remove unnecessary rule

* Fix type error
2019-05-29 18:19:32 -07:00
JJ Kasper
28f1ca4f3e
re-add prefetch prop type with deprecated (#7292) 2019-05-10 14:33:40 -05:00
JJ Kasper
b97a47d273 Fix attempting to observe non-DOM refs in Link (#7249)
handleRef isn't called with valid DOM node
2019-05-06 15:44:18 +02:00
JJ Kasper
adbc1a8857
Remove unnecessary type from LinkProps (#7233) 2019-05-03 09:50:34 -05:00
JJ Kasper
2776dc731c Use intersection observer to preload in viewport (#7196)
* Use intersection observer to preload
links that are in viewport

* Clean up names

* Check for window before returning observer

* update check for IntersectionObserver

* Remove duplicate IntersectionObserver checks

* Add test for prefetching links in viewport
2019-05-01 15:14:27 +02:00
Tim Neutkens
f8eb392fa5
Add types for next/link (#7160)
* Add types for next/link

* Fix link type errors

* fix router type error
2019-04-25 21:31:53 +02:00
Renamed from packages/next/client/link.js (Browse further)