Commit 0f9b5e74 authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

remove nextjs link prefetch (#2537)

parent 64d1f392
......@@ -30,6 +30,11 @@ const RESTRICTED_MODULES = {
importNames: [ 'Popover', 'Menu', 'PinInput', 'useToast', 'Skeleton' ],
message: 'Please use corresponding component or hook from ui/shared/chakra component instead',
},
{
name: 'next/link',
importNames: [ 'default' ],
message: 'Please use ui/shared/NextLink component instead',
},
],
patterns: [
'icons/*',
......
import { Box, Flex, IconButton, Tooltip } from '@chakra-ui/react';
import { useQueryClient, useIsFetching } from '@tanstack/react-query';
import { sumBy } from 'es-toolkit';
import NextLink from 'next/link';
import { useRouter } from 'next/router';
import React from 'react';
......@@ -13,6 +12,7 @@ import * as mixpanel from 'lib/mixpanel/index';
import getQueryParamString from 'lib/router/getQueryParamString';
import Skeleton from 'ui/shared/chakra/Skeleton';
import IconSvg from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import useFetchTokens from '../utils/useFetchTokens';
import TokenSelectDesktop from './TokenSelectDesktop';
......
import { Link, useColorModeValue, LinkBox, Flex, Image, LinkOverlay, IconButton } from '@chakra-ui/react';
import NextLink from 'next/link';
import type { MouseEvent } from 'react';
import React, { useCallback } from 'react';
......@@ -8,6 +7,7 @@ import type { MarketplaceAppPreview } from 'types/client/marketplace';
import useIsMobile from 'lib/hooks/useIsMobile';
import * as mixpanel from 'lib/mixpanel/index';
import Skeleton from 'ui/shared/chakra/Skeleton';
import NextLink from 'ui/shared/NextLink';
import FavoriteIcon from '../FavoriteIcon';
import MarketplaceAppIntegrationIcon from '../MarketplaceAppIntegrationIcon';
......
import { LinkOverlay, chakra } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react';
import type { MouseEvent } from 'react';
import NextLink from 'ui/shared/NextLink';
type Props = {
id: string;
url: string;
......
import { Button } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react';
import NextLink from 'ui/shared/NextLink';
type Props = {
id: string;
url: string;
......
import { Heading, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalOverlay, Text, Button, useColorModeValue } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react';
import useIsMobile from 'lib/hooks/useIsMobile';
import NextLink from 'ui/shared/NextLink';
type Props = {
isOpen: boolean;
......
// eslint-disable-next-line no-restricted-imports
import NextLink, { type LinkProps as NextLinkProps } from 'next/link';
import type { ReactNode } from 'react';
type LinkProps = NextLinkProps & { children?: ReactNode };
const Link = ({ prefetch = false, children, ...rest }: LinkProps) => {
return (
<NextLink prefetch={ prefetch } { ...rest }>
{ children }
</NextLink>
);
};
export default Link;
......@@ -5,7 +5,6 @@ import {
Tooltip,
useColorModeValue,
} from '@chakra-ui/react';
import NextLink from 'next/link';
import React, { useRef } from 'react';
import type { TimeChartItem } from './types';
......@@ -15,6 +14,7 @@ import { route, type Route } from 'nextjs-routes';
import config from 'configs/app';
import Skeleton from 'ui/shared/chakra/Skeleton';
import IconSvg from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import ChartMenu from './ChartMenu';
import ChartWidgetContent from './ChartWidgetContent';
......
import type { LinkProps, FlexProps } from '@chakra-ui/react';
import { Flex, Link } from '@chakra-ui/react';
import type { LinkProps as NextLinkProps } from 'next/link';
import NextLink from 'next/link';
import type { LegacyRef } from 'react';
import React from 'react';
import NextLink from 'ui/shared/NextLink';
import type { Variants } from './useLinkStyles';
import { useLinkStyles } from './useLinkStyles';
......
import { Box, Flex, Text, useColorModeValue, chakra } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react';
import type { Route } from 'nextjs-routes';
......@@ -7,6 +6,7 @@ import type { Route } from 'nextjs-routes';
import Skeleton from 'ui/shared/chakra/Skeleton';
import Hint from 'ui/shared/Hint';
import IconSvg, { type IconName } from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import TruncatedValue from 'ui/shared/TruncatedValue';
export type Props = {
......
import { Link, Text, HStack, Tooltip, Box, useBreakpointValue } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react';
import type { NavItem } from 'types/client/navigation';
......@@ -9,6 +8,7 @@ import { route } from 'nextjs-routes';
import useIsMobile from 'lib/hooks/useIsMobile';
import { isInternalItem } from 'lib/hooks/useNavItems';
import IconSvg from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import LightningLabel, { LIGHTNING_LABEL_CLASS_NAME } from '../LightningLabel';
import NavLinkIcon from '../NavLinkIcon';
......
import { Image, Flex, Text, useColorModeValue } from '@chakra-ui/react';
import NextLink from 'next/link';
import React from 'react';
import type { MarketplaceAppOverview } from 'types/client/marketplace';
import highlightText from 'lib/highlightText';
import IconSvg from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import SearchBarSuggestItemLink from './SearchBarSuggestItemLink';
......
import type { LinkProps as NextLinkProps } from 'next/link';
import NextLink from 'next/link';
import React from 'react';
import type { SearchResultItem } from 'types/client/search';
......@@ -7,6 +6,8 @@ import type { AddressFormat } from 'types/views/address';
import { route } from 'nextjs-routes';
import NextLink from 'ui/shared/NextLink';
import SearchBarSuggestAddress from './SearchBarSuggestAddress';
import SearchBarSuggestBlob from './SearchBarSuggestBlob';
import SearchBarSuggestBlock from './SearchBarSuggestBlock';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment