Skip to content

Commit

Permalink
Fix scope passed to brevoTestContactsSelectQuery (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliawegmayr authored Feb 13, 2025
1 parent c26b202 commit 5059c86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wet-news-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/brevo-admin": patch
---

Fix scope in brevoTestContactsSelectQuery
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Card } from "@mui/material";
import React from "react";
import { FormattedMessage } from "react-intl";

import { useBrevoConfig } from "../../common/BrevoConfigProvider";
import { GQLBrevoTestContactsSelectListFragment } from "./TestEmailCampaignForm.generated";
import { SendEmailCampaignToTestEmailsMutation } from "./TestEmailCampaignForm.gql";
import { GQLSendEmailCampaignToTestEmailsMutation, GQLSendEmailCampaignToTestEmailsMutationVariables } from "./TestEmailCampaignForm.gql.generated";
Expand Down Expand Up @@ -41,7 +42,14 @@ const brevoTestContactsSelectQuery = gql`

export const TestEmailCampaignForm = ({ id, isSendable = false }: TestEmailCampaignFormProps) => {
const client = useApolloClient();
const scope = useContentScope();

const { scopeParts } = useBrevoConfig();
const { scope: completeScope } = useContentScope();

const scope = scopeParts.reduce((acc, scopePart) => {
acc[scopePart] = completeScope[scopePart];
return acc;
}, {} as { [key: string]: unknown });

// Contact creation is limited to 100 at a time. Therefore, 100 contacts are queried without using pagination.
const { data, loading, error } = useQuery(brevoTestContactsSelectQuery, {
Expand Down

0 comments on commit 5059c86

Please sign in to comment.