I am encountering an incredibly weird bug at the moment.
const defaultCampaign: CampaignNpoCreate = {
general: {
campaignName: '',
languages: [],
urlName: '',
campaignLogo: '-',
approveP2P: false,
},
mail: {
enableThanksMail: false,
enableFiscalCertificateMail: false,
thanksMail: '',
},
};
This defaultCampaign (it’s simplified a bit) serves as the basis for the creation of a campaign. After running this code:
const campaign = defaultCampaign;
console.log(campaign);
console.log(campaign.mail);
the first log shows ‘mail’ as having the same properties as ‘general’, but the second log does show the correct information. When using the campaign object in the form, it does not have the correct information either.
I’ve tried destructuring the defaultCampaign (const campaign = { ...defaultCampaign })
and setting the defaultCampaign to a function that returns the CampaignNpoCreate object, same result.
For context, this code is used in a Vue app.
Jonathan Couck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.