Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filter path because a dynamic zone is a component but it should be classified as a dynamic zone #15139

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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))
joshuaellis marked this conversation as resolved.
Show resolved Hide resolved
.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