Confusion with marks and toggleMark

So I’m trying to make my own toolbar in React. I’m using prosemirror-example-setup and prosemirror-menu and trying to copy bits and pieces from there. I’m using ClojureScript so not sure if any code snippets might be useful to anyone else :confused:

I’m seeing two issues that might be related:

  1. My bold/strong button is never “active”. The markActive function which is a literal copy of the one in prosemirror-example-setup/menu.js at master · ProseMirror/prosemirror-example-setup · GitHub returns false.
  2. Whenever I click the bold button, I see the marks applied to the text nodes, but never un-applied; as a second press of the toolbar will add another mark.

Whenever I use cmd-b it toggles/untoggles the selection as expected, but it seems like it’s in its own parallel universe. I was suspicious that the React integration (via use-prosemirror) would be at blame but I have verified that the state available via that is the same as the state accessible via view.state.

Any pointers on how to debug this would be helpful.

Are you maybe using mark types from different schemas? That might cause some of these symptoms.

Thank you so much, I was creating the schema inside a React render method and it was recreated on every render. Moving that out fixed the issue, now everything works as expected. Many thanks again!