mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 17:26:11 +00:00
Persist plugin option for an entry
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
97d127f54e
commit
a54ae6d74f
@ -4,6 +4,7 @@ import { useLocation, useHistory } from 'react-router-dom';
|
|||||||
import { FormattedMessage, useIntl } from 'react-intl';
|
import { FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { upperFirst, isEmpty } from 'lodash';
|
import { upperFirst, isEmpty } from 'lodash';
|
||||||
import { LoadingIndicator, useGlobalContext } from 'strapi-helper-plugin';
|
import { LoadingIndicator, useGlobalContext } from 'strapi-helper-plugin';
|
||||||
|
import { parse, stringify } from 'qs';
|
||||||
import useListView from '../../hooks/useListView';
|
import useListView from '../../hooks/useListView';
|
||||||
import { getTrad } from '../../utils';
|
import { getTrad } from '../../utils';
|
||||||
import State from '../State';
|
import State from '../State';
|
||||||
@ -26,8 +27,13 @@ const CustomTable = ({
|
|||||||
const { entriesToDelete, label, filters, _q } = useListView();
|
const { entriesToDelete, label, filters, _q } = useListView();
|
||||||
const { emitEvent } = useGlobalContext();
|
const { emitEvent } = useGlobalContext();
|
||||||
|
|
||||||
const { pathname } = useLocation();
|
const { pathname, search } = useLocation();
|
||||||
|
const query = search ? parse(search.substring(1)) : {};
|
||||||
const { push } = useHistory();
|
const { push } = useHistory();
|
||||||
|
const searchToPersist = query.pluginOptions
|
||||||
|
? stringify(query.pluginOptions, { encode: false })
|
||||||
|
: '';
|
||||||
|
|
||||||
const headers = useMemo(() => {
|
const headers = useMemo(() => {
|
||||||
if (hasDraftAndPublish) {
|
if (hasDraftAndPublish) {
|
||||||
return [
|
return [
|
||||||
@ -62,6 +68,7 @@ const CustomTable = ({
|
|||||||
push({
|
push({
|
||||||
pathname: `${pathname}/${id}`,
|
pathname: `${pathname}/${id}`,
|
||||||
state: { from: pathname },
|
state: { from: pathname },
|
||||||
|
search: searchToPersist,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handleEditGoTo = id => {
|
const handleEditGoTo = id => {
|
||||||
@ -69,6 +76,7 @@ const CustomTable = ({
|
|||||||
push({
|
push({
|
||||||
pathname: `${pathname}/${id}`,
|
pathname: `${pathname}/${id}`,
|
||||||
state: { from: pathname },
|
state: { from: pathname },
|
||||||
|
search: searchToPersist,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user