Skip to content

the onConsentChanged callback doesn't work as expected #102

Description

@Snaylaker

Hi ,

I'm experiencing an issue where onConsentChanged does not trigger properly when changing consents. However, when using an event listener, I can capture consent changes immediately.

This doesn't work :/


<DidomiSDK
        apiKey={config.thirdparty.didomi.apiKey}
        iabVersion={2}
        config={{
          user: {
            bots: {
              consentRequired: false,
            },
          },
          sync: {
            enabled: true,
            delayNotice: true,
          },
        }}
        noticeId={config.thirdparty.didomi.noticeId}
        gdprAppliesGlobally={true}
        embedTCFStub={true}
        onConsentChanged={cwtToken => {
          return console.log('A consent has been given/withdrawn', cwtToken);
        }}
/>

This works, i get the console.log message

<DidomiSDK
        apiKey={config.thirdparty.didomi.apiKey}
        iabVersion={2}
        config={{
          user: {
            bots: {
              consentRequired: false,
            },
          },
          sync: {
            enabled: true,
            delayNotice: true,
          },
        }}
        noticeId={config.thirdparty.didomi.noticeId}
        gdprAppliesGlobally={true}
        embedTCFStub={true}
        onReady={didomiSdk => {
          didomiSdk.on('consent.changed', () => {
            console.log('consent changed inside event listener');
          });
/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions