Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: soupette <cyril.lpz@gmail.com>
Signed-off-by: Gil Fernandes <gil.fernandes@onepointltd.com>
  • Loading branch information
soupette authored and onepointconsulting committed Aug 13, 2020
1 parent 62b6e81 commit 87c0838
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { Prompt, useHistory, useLocation } from 'react-router-dom';
import PropTypes from 'prop-types';
import { get, has, isEqual } from 'lodash';
Expand Down Expand Up @@ -255,15 +255,15 @@ const ListView = () => {
handleClickAddField(forTarget, targetUid, headerDisplayObject);
},
};
const goToCMSettingsPage = () => {
const goToCMSettingsPage = useCallback(() => {
const endPoint = isInContentTypeView
? `/plugins/content-manager/${contentTypeKind}/${targetUid}/ctm-configurations/edit-settings/content-types`
: `/plugins/content-manager/ctm-configurations/edit-settings/components/${targetUid}/`;

if (!isTemporary) {
push(endPoint);
}
};
}, [contentTypeKind, isInContentTypeView, isTemporary, push, targetUid]);

const listInjectedComponents = useMemo(() => {
return getComponents('listView', 'list.link', plugins, {
Expand All @@ -272,8 +272,7 @@ const ListView = () => {
isInContentTypeView,
contentTypeKind,
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isTemporary, isInContentTypeView, contentTypeKind]);
}, [plugins, goToCMSettingsPage, isTemporary, isInContentTypeView, contentTypeKind]);

const listActions = isInDevelopmentMode
? [...listInjectedComponents, <ListButton {...addButtonProps} key="add-button" />]
Expand Down

0 comments on commit 87c0838

Please sign in to comment.