[9382][FRONT]: Compute highlighted object view using raw name plural (#9394)
# Introduction Please find related ticket here #9382 To fix the issue the solution seems to be to stop searching for last viewed `objectMetadata` using their slugged version `namePlural` ## Upcoming cleanup After discussing with @charlesBochet it seems like a bad practice to slug the `objectMetadata`, in this way in a following PR we will suggest a cleanup of the remaining method that does within the `useFilteredObjectMetadataItems.ts` ## Conclusion As always any suggestions are welcomed ! Please let me know closes #9382 --------- Co-authored-by: Paul Rastoin <paulrastoin@Pauls-MacBook-Pro.local>
This commit is contained in:
@ -29,7 +29,7 @@ export const useLastVisitedView = () => {
|
||||
setLastVisitedViewPerObjectMetadataItem,
|
||||
] = useRecoilState(lastVisitedViewPerObjectMetadataItemState);
|
||||
|
||||
const { findActiveObjectMetadataItemBySlug } =
|
||||
const { findActiveObjectMetadataItemByNamePlural } =
|
||||
useFilteredObjectMetadataItems();
|
||||
|
||||
const setFallbackForLastVisitedView = (objectMetadataItemId: string) => {
|
||||
@ -49,7 +49,7 @@ export const useLastVisitedView = () => {
|
||||
viewId: string;
|
||||
}) => {
|
||||
const fallbackObjectMetadataItem =
|
||||
findActiveObjectMetadataItemBySlug(objectNamePlural);
|
||||
findActiveObjectMetadataItemByNamePlural(objectNamePlural);
|
||||
|
||||
if (isDefined(fallbackObjectMetadataItem)) {
|
||||
/* when both are equal meaning there was change in view else
|
||||
@ -72,7 +72,7 @@ export const useLastVisitedView = () => {
|
||||
objectNamePlural: string,
|
||||
) => {
|
||||
const objectMetadataItemId: string | undefined =
|
||||
findActiveObjectMetadataItemBySlug(objectNamePlural)?.id;
|
||||
findActiveObjectMetadataItemByNamePlural(objectNamePlural)?.id;
|
||||
return objectMetadataItemId
|
||||
? lastVisitedViewPerObjectMetadataItem?.[objectMetadataItemId]
|
||||
: undefined;
|
||||
|
||||
Reference in New Issue
Block a user