React error when i deactive my plugin in dev

Hello, I am developing a plugin and it is already as I want it, I only have one problem and it is when I deactivate the plugin I get the following error. Any idea what’s going on?

this happens when i go to preview

My code:

Link-card give me the same problem, maybe is only my case

Hi lofidev,

That looks cool.
I’ve tried to reproduce it but it successfully gets deactivated.
I guess another plugin is causing that? I see some plugins are not deactivating properly.

1 Like

btw, I thought I have to write a codeblock after seeing this example:

CleanShot 2022-04-14 at 09.30.54@2x

But the backticks are not necessary for the plugin.
Maybe you want to remove them.

1 Like

Got it to reproduce.
So, the error is:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

That is caused by this line:

Because the original P component can be undefined.
You should unset the p property instead if it was undefined something like:

if (this.origPComponent !== undefined) {
  markdownRenderer.remarkReactComponents.p = this.origPComponent;
} else {
  delete markdownRenderer.remarkReactComponents.p;
1 Like

Thanks @craftzdog, solution works perfectly.
I published my plugin, but i have a problem with version.

i cant change the plugin version with the command
ipm publish --tag v0.1.0
currently the plugin can be downloaded because I added a v0.0.0 tag on my github

Can you try incrementing the version number like so?

ipm publish [patch | minor | major]
1 Like

For some reason it doesn’t work for me, I don’t know if the error affects the publish

the deprecation warning is just a warning and shouldn’t matter because I can still also publish the packages as usual.

1 Like

yea that’s nothing to do with plugins themselves.
I guess that’s because the tag v0.1.0 already exists.

1 Like

I’ve been trying but I still couldn’t, the steps I followed are the following:

  1. Create a git tag v0.8.0 (this is a tag that I never create)
    Command : git tag v0.8.0
  2. Push tag to github
    command : git push --tags
  3. At this point my package.json already had version v0.7.0, so running the command ipm publish minor i pushed the new tag
    Pushing v0.8.0 tag

I’m sorry for the inconvenience and your wasted time :sweat:, I think I’m doing something wrong and I hope it won’t be repeated in other projects I have in mind.

The git tag would automatically be created by ipm tool. So you shouldn’t need to manually create it via git, that might be the cause of ipm failing.

Yes, ipm does that automatically.