Skip to content

Commit

Permalink
chore: import isDev
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyib committed Aug 3, 2023
1 parent bb5b57e commit 522ee8f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/hooks/src/useHistoryTravel/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useRef, useState } from 'react';
import useMemoizedFn from '../useMemoizedFn';
import { isNumber } from '../utils';
import isDev from '../utils/isDev';

interface IData<T> {
present?: T;
Expand Down Expand Up @@ -45,8 +46,11 @@ export default function useHistoryTravel<T>(

if (typeof options === 'number') {
maxLength = options;

if (isDev) {
console.warn('[ahooks: useHistoryTravel] `maxLength` is deprecated which will be removed in next major version, please use `options.maxLength` instead.');
console.warn(
'[ahooks: useHistoryTravel] `maxLength` is deprecated which will be removed in next major version, please use `options.maxLength` instead.',
);
}
} else if (typeof options === 'object') {
maxLength = options?.maxLength ?? maxLength;
Expand Down

0 comments on commit 522ee8f

Please sign in to comment.