Merge branch 'master' of github.com:payloadcms/payload

This commit is contained in:
Dan Ribbens
2023-06-06 11:32:46 -04:00
2 changed files with 6 additions and 10 deletions

View File

@@ -1,14 +1,8 @@
import React, {
createContext,
useCallback,
useContext,
useEffect,
useRef,
useState,
} from 'react';
import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
import { useHistory } from 'react-router-dom';
import queryString from 'qs';
import { Where } from '../../../../../../types';
import { useLocale } from '../../../../utilities/Locale';
export enum SelectAllStatus {
AllAvailable = 'allAvailable',
@@ -38,6 +32,7 @@ export const SelectionProvider: React.FC<Props> = ({ children, docs = [], totalD
const contextRef = useRef({} as SelectionContext);
const history = useHistory();
const locale = useLocale();
const [selected, setSelected] = useState<SelectionContext['selected']>({});
const [selectAll, setSelectAll] = useState<SelectAllStatus>(SelectAllStatus.None);
const [count, setCount] = useState(0);
@@ -98,8 +93,9 @@ export const SelectionProvider: React.FC<Props> = ({ children, docs = [], totalD
}
return queryString.stringify({
where,
locale,
}, { addQueryPrefix: true });
}, [history.location.search, selectAll, selected]);
}, [history.location.search, selectAll, selected, locale]);
useEffect(() => {
if (selectAll === SelectAllStatus.AllAvailable) {

View File

@@ -94,7 +94,7 @@ async function update<TSlug extends keyof GeneratedTypes['globals']>(
}
const originalDoc = await afterRead({
depth,
depth: 0,
doc: globalJSON,
entityConfig: globalConfig,
req,