orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js
https://playground.cookieconsent.orestbida.com/
MIT License
4.06k stars 416 forks source link

[Bug]: Services get unselected when changing state of another category #745

Open morja opened 4 weeks ago

morja commented 4 weeks ago

Expected Behavior

Changing the state of a category should only affect its child services

Current Behavior

I have two categories next to the necessary one

  categories: {,
    youtube_videos: {
      services: {
        youtube_embed: {
          label: 'Youtube Embed',
          onAccept: () => im.acceptService('youtube_embed'),
          onReject: () => im.rejectService('youtube_embed')
        }
      }
    },
    other: {
      services: {
        newsletter: {
          label: 'Newsletter form',
        },
        payment: {
          label: 'Payment form',
        },
      }
    },
}

When I accept one of the categories and save it. And then I enable another category and then reload the page, the children of the other category get disabled.

Steps to reproduce

  1. Click on one category and save then it. Then it and its children are enabled
  2. Reload the page
  3. Click on another category (either turning it on or off) and save
  4. Reload the page
  5. Then the children of other are turned off again

Proposed fix or additional info.

No response

Version

3.0.1

On which browser do you see the issue?

Chrome

Am I doing something wrong?