Skip to content

Commit

Permalink
fix: filter path because a dynamic zone component is a component but …
Browse files Browse the repository at this point in the history
…it should be classified as a dynamic zone
  • Loading branch information
joshuaellis committed Dec 8, 2022
1 parent 11d5ceb commit faccd12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const DynamicZoneComponent = ({
<StyledBox hasRadius>
<Accordion expanded={isOpen} onToggle={handleToggle} size="S" error={errorMessage}>
<AccordionToggle
startIcon={<FontAwesomeIcon icon={icon} />}
startIcon={icon && <FontAwesomeIcon icon={icon} />}
action={
<Stack horizontal spacing={0} expanded={isOpen}>
{showDownIcon && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ const recursivelyFindPathsBasedOnConditionSetup = (components, predicate = () =>
*
* NOTE: we don't need to know the path to the `array` because it's about data shape not about the actual data
*/
}).map((path) => path.split(`${componentName}.`)[1]);
}).map((path) => {
return path.split(`${componentName}.`)[1];
});
})
/**
* We filter because this will give you `dynamiczone.undefined` because the dynamic_zone component
* is not required to be returned in this circumstance.
*/
.filter((path) => Boolean(path))
.map((path) => `${key}.${path}`);

acc = [...acc, attributesInDynamicComponents];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const RelationInputDataManager = ({
const { connectRelation, disconnectRelation, loadRelation, modifiedData, slug, initialData } =
useCMEditViewDataManager();

const relationsFromModifiedData = get(modifiedData, name) ?? [];
const relationsFromModifiedData = get(modifiedData, name, []);

const currentLastPage = Math.ceil(get(initialData, name, []).length / RELATIONS_TO_DISPLAY);

Expand Down

0 comments on commit faccd12

Please sign in to comment.