Try to assign the closest parent when using optional chaining. If the closest parent is not, then something like the following will be output:
// original - multiple defintions of a comment parent `viewer?.user?.curatedFolderActivity?.edges?.[0]?.node`
const elementId = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.serviceId;
const folderPk = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.anchors?.[0]?.source?.serviceId;
const folderUrlLabel = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.anchors?.[0]?.source?.name;
const repName = viewer?.userRelationships?.[0]?.userDataB?.[0]?.displayName;
const imageSrc = viewer?.user?.curatedFolderActivity?.edges?.[0]?.node?.anchors?.[0]?.source?.firstItemImage || '';
outputs (scroll left -> right to see full output)