Actions not updating the state

Hello guy,
thank for this amazing framwork.
I’m building my new site using it and every thing is going great until I found that my actions doesn’t update the state

I have this state

state: {
    theme: {
        color: '#559acb',
        isExtraLinksOpen: true,
        isMenuOpen: false,
        linksNumber: 5,

and this action which logs the old state and then toggle it

actions: {
    theme: {
        toggleExtraLinks: ({state}) => {
            console.log('old state: ', state.theme.isExtraLinksOpen);
            state.theme.isExtraLinksOpen = !state.theme.isExtraLinksOpen

I added the toggleExtraLinks function to this button as following

<div className={className} onClick={actions.theme.toggleExtraLinks}>

but every time the old state is ALWAYS false
so the menu is always OPENED

what am I doing wrong ???

I recorded this video so I can show you a strange behavior I noticed with the state

1 Like

Hi @modyydom!

I just watched your video and I can’t tell you what happens :sweat_smile:. The code looks fine. There is almost the same in @frontity/mars-theme to toggle a menu.

Could you send us an example in CodeSandbox or similar reproducing the problem (or share your project) so we can take a deeper look to this?

As David said, @modyydom it’d be great to have a repo to be able to take a deeper look. The code looks fine.

If you can’t share your whole project, please create a codesandbox (you can use this template) or a GitHub repo with the minimal amount of code to reproduce the issue.

sorry for the delayed response.
I’ll create a repo ASAP but please give me some time to finalize my current project and deliver it :smiley:

No problem! :slight_smile: