Skip to content

Update to build against React 19 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 31, 2025
Merged

Conversation

anjackson
Copy link
Contributor

This PR attempts to upgrade the dependencies of this widget so it can run in the most recent release of DecapCMS (3.7.1) which uses React 19. Running in dev mode, this seems to work as expected.

However, when trying to import this module and use it with the version of DecapCMS installed in an admin page, e.g. using

npm run build
cp dist/index.js {TARGET_LOCATION}

Then...

 <body>
    <script>
      window.CMS_MANUAL_INIT = true
    </script>
    <!-- Include the script that builds the page and powers Decap CMS -->
    <script type="text/javascript" src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
    <script type="text/javascript" src="./index.js"></script>
    <script type="module">
      CMS.registerWidget('create-select', window.CreatableSelectControl, window.CreatableSelectPreview)
      CMS.init();
    </script>

I get an error when attempting to view the widget:

TypeError: Cannot read properties of null (reading 'useState') at t.useState

Which is being thrown in react-state/creatable, I think.

I am not an experienced React developer, so I may well be making some kind of basic mistake. Apologies if so.

@anjackson
Copy link
Contributor Author

Well, the version that seemed to work was actually the local dev version when running under vite (https://github.com/anjackson/decap-cms-widget-create-select/tree/use-vite). After having set the thing up to run under webpack, the same error happens when viewing the widgets after running npm run start.

@Andful
Copy link
Owner

Andful commented Jul 28, 2025

Thank you for the pull. Sorry if I am answering just now. It went under my radar. It has been a while since I use NetlifyCMS (now DecapCMS). I will check the PR.

@Andful
Copy link
Owner

Andful commented Jul 29, 2025

I see that the pull request is a draft. Do you not want me to merge it?

I also see that you made a fork with a better fitting name. I don't maintain this repo anymore. Can I archive this repo and forward to your repo in the README?

@Andful Andful merged commit 9caf048 into Andful:master Jul 31, 2025
0 of 4 checks passed
@Andful
Copy link
Owner

Andful commented Jul 31, 2025

I misunderstood your pull-request. The updates have been made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants