mirror of
https://github.com/strapi/strapi.git
synced 2025-10-29 17:04:13 +00:00
Merge branch 'master' into develop
This commit is contained in:
commit
12260bae16
@ -103,7 +103,7 @@ Limit the result length to 30.
|
||||
|
||||
`GET /users?_limit=30`
|
||||
|
||||
You can require the full data set by passing a limit equal to `-1`
|
||||
You can require the full data set by passing a limit equal to `0`
|
||||
|
||||
### Start
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ Upgrading your Strapi application to `v3.0.0-beta.17.4`.
|
||||
|
||||
## Upgrading your dependencies
|
||||
|
||||
Start by upgrading your dependencies. Make sur to use exact versions.
|
||||
Start by upgrading your dependencies. Make sure to use exact versions.
|
||||
|
||||
::: danger
|
||||
`strapi-plugin-settings-manager` has been deprecated. you need to remove it from your `package.json`.
|
||||
|
||||
@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef, memo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { isArray, isEmpty } from 'lodash';
|
||||
import { isArray, isEmpty, cloneDeep } from 'lodash';
|
||||
import { request } from 'strapi-helper-plugin';
|
||||
|
||||
import pluginId from '../../pluginId';
|
||||
@ -41,12 +41,15 @@ function SelectWrapper({
|
||||
});
|
||||
const [options, setOptions] = useState([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const abortController = new AbortController();
|
||||
const { signal } = abortController;
|
||||
const ref = useRef();
|
||||
const startRef = useRef();
|
||||
startRef.current = state._start;
|
||||
|
||||
ref.current = async (signal, params = state) => {
|
||||
ref.current = async () => {
|
||||
try {
|
||||
const params = cloneDeep(state);
|
||||
const requestUrl = `/${pluginId}/explorer/${targetModel}`;
|
||||
|
||||
if (isEmpty(params._q)) {
|
||||
@ -91,34 +94,50 @@ function SelectWrapper({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const abortController = new AbortController();
|
||||
const { signal } = abortController;
|
||||
ref.current(signal);
|
||||
ref.current();
|
||||
|
||||
return () => {
|
||||
abortController.abort();
|
||||
};
|
||||
}, [ref]);
|
||||
|
||||
const onInputChange = inputValue => {
|
||||
setState(prevState => {
|
||||
if (prevState._q === inputValue) {
|
||||
return prevState;
|
||||
}
|
||||
useEffect(() => {
|
||||
if (state._q !== '') {
|
||||
ref.current();
|
||||
}
|
||||
|
||||
return { ...prevState, _q: inputValue };
|
||||
});
|
||||
return () => {
|
||||
abortController.abort();
|
||||
};
|
||||
}, [state._q]);
|
||||
|
||||
ref.current();
|
||||
useEffect(() => {
|
||||
if (state._start !== 0) {
|
||||
ref.current();
|
||||
}
|
||||
|
||||
return () => {
|
||||
abortController.abort();
|
||||
};
|
||||
}, [state._start]);
|
||||
|
||||
const onInputChange = (inputValue, { action }) => {
|
||||
if (action === 'input-change') {
|
||||
setState(prevState => {
|
||||
if (prevState._q === inputValue) {
|
||||
return prevState;
|
||||
}
|
||||
return { ...prevState, _q: inputValue };
|
||||
});
|
||||
}
|
||||
|
||||
return inputValue;
|
||||
};
|
||||
|
||||
const onMenuScrollToBottom = () => {
|
||||
setState(prevState => ({ ...prevState, _start: prevState._start + 1 }));
|
||||
|
||||
ref.current();
|
||||
};
|
||||
|
||||
const isSingle = [
|
||||
'oneWay',
|
||||
'oneToOne',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user