-
Notifications
You must be signed in to change notification settings - Fork 38
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
Switch from useCMEditViewDataManager()
to useDocument()
#140
Conversation
1be98d4
to
40b5768
Compare
Hi @jackbuehner I really appreciate the work you put into this PR! 🎉 I hate to break it to you 💔 that I've already handled a lot of this upgrade before seeing your PR, and I converted everything into TypeScript so it presents quite a conflict with your PR. However, would you be interested in still rebasing this branch with the latest changes in PR 133 and migrating the I wonder if that implementation is going to change before the final v5 release but either way, it would be nice because I have not worked with migrating that functionality in a plugin yet 😄 Plus I don't want to steal your Github cred and this would be a good opportunity to be listed as a contributor. I'm happy to discuss other improvements that might be needed too. |
No worries! I like the move to TypeScript. I would have posted about contributing on the PR, but I was in the zone on updating everything and just decided to do it. I'm happy to rebase with your latest changes. It probably can't do it today, but I can definitely do it before the end of the weekend, if that is okay. They said there shouldn't be too many more big changes now that we are in the release candidate phase, so hopefully this is how it will be. But who knows – they have not yet fully documented the replacements for |
Are you okay with switching |
Oh sure, |
`useCMEditViewDataManager()` is no longer available in strapi 5 because `@strapi/helper-plugin` is not going to be upgraded to version 5.
43f794f
to
a253b4d
Compare
useCMEditViewDataManager()
to useDocument()
Sorry it took a little longer (I got sick). I just did a hard reset to your version of the |
@jackbuehner Here are some additional things I found after running
|
@jackbuehner Also, have you tested your updates in a local Strapi app? When I configure the bare minimum config for a content type, I'm getting this error and I'm not sure what's causing it. Curious if you ran into this or not. |
I did, but it was an earlier release candidate. Maybe something changed? I'll give it a look. |
The bundle has its own copy of @strapi/admin. This means that the You can verify that the bundled version is being used by adding
It was not a problem earlier in my PR because I had used rollup and was not bundling
The code for build from Any ideas? @mattmilburn |
@jackbuehner Just an update - I'm reaching out to Strapi support on Discord. This is a popular plugin that even the Strapi team uses internally, so don't worry - we will get this figured out soon enough 🤞🏻 |
Thanks @mattmilburn. My last thought was to use |
Might be related to strapi/strapi#21151 |
Hey guys. I think they fix it in strapi 5.0.3 |
Unfortunately I'm still seeing the same error after updating to v5.0.3. |
@jackbuehner This is possibly fixed in v5.0.5 🤞🏻 EDIT: Actually, false alarm. The issue is still happening in v5.0.5 😞 |
Not able to migrate plugins to version 5 yet! |
Same issue in v5.3.0 |
@jackbuehner @mattmilburn there was an update from the Strapi team in this comment. It appears that the bug is only present when the plugin depends on an RC release of Strapi. Could you try updating the plugin to the latest Strapi? In my comment above I might have only bumped the main project's dependency. |
This is still a problem in v5.4.0. I've created an issue with Strapi to describe the problem in case anyone is interested. |
@jackbuehner Problem solved - I was testing this by adding the plugin to a test application's package.json with Merging this PR now and I'll cleanup the rest of the plugin details and get it ready to deploy v3 for Strapi 5 🚀 🎉
|
Dang... I was doing the same thing. Really wanted to avoid |
|
This PR finishes replacing usage of @strapi/helper-plugin. (@strapi/helper-plugin is deprecated and is not compatible with Strapi 5.) It builds on builds on #133.
useCMEditViewDataManager()
from @strapi/helper-plugin has no direct replacement, but the part used by this plugin is replaced byuseDocument()
from@strapi/admin/strapi-admin
.This PR also switches the
<Button />
component usage to<LinkButton />
. They look the same, but they allow right clicking to copy links and middle clicking to open in a new tab. If you click them, they behave exactly as the always have;event.preventDefault()
is called and the regular logic takes over.