Fix Views on People page (#2265)

* fetching viewId for url

* fixed option menu name input

* fix table import

* fix unnecessary rerenders

* people working

---------

Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
Charles Bochet
2023-10-27 18:20:58 +02:00
committed by GitHub
parent 35237c05f3
commit afd4b7c634
14 changed files with 202 additions and 75 deletions

View File

@ -67,15 +67,10 @@ export const ViewsDropdownButton = ({
onViewEditModeChange,
}: ViewsDropdownButtonProps) => {
const theme = useTheme();
const { scopeId, removeView, currentViewId } = useView();
const { scopeId, removeView, currentViewId, changeView } = useView();
const {
views,
currentView,
setViewEditMode,
setCurrentViewId,
entityCountInCurrentView,
} = useViewInternalStates(scopeId, currentViewId);
const { views, currentView, setViewEditMode, entityCountInCurrentView } =
useViewInternalStates(scopeId, currentViewId);
const {
isDropdownOpen: isViewsDropdownOpen,
@ -90,11 +85,11 @@ export const ViewsDropdownButton = ({
const handleViewSelect = useRecoilCallback(
() => async (viewId: string) => {
setCurrentViewId(viewId);
changeView(viewId);
closeViewsDropdown();
},
[setCurrentViewId, closeViewsDropdown],
[changeView, closeViewsDropdown],
);
const handleAddViewButtonClick = () => {
@ -109,7 +104,7 @@ export const ViewsDropdownButton = ({
viewId: string,
) => {
event.stopPropagation();
setCurrentViewId(viewId);
changeView(viewId);
setViewEditMode('edit');
onViewEditModeChange?.();
closeViewsDropdown();