am-impact / amcommand

Command palette in Craft; Because you can
Other
87 stars 8 forks source link

Simple Map plugin breaks when Comand Palette enabled #33

Closed juresrpcic closed 6 years ago

juresrpcic commented 6 years ago

I'm not sure which plugin is causing the issue, but this issue: https://github.com/ethercreative/simplemap/issues/61 explains how having Command Palette enabled breaks Craft CP entirely by causing this error:

Internal Server Error
Call to a member function getMap() on null

This is the comment from Simple Map author:

That error suggests that the field type was being called in some way before the rest of the plugin had been initialised. It's most likely that one of the other plugins you had installed was causing this.

The original issue has my logs and this might help figuring out the issue as well:

If I just uninstall that one (Command Palette plugin), I can create the Map field again. But funny enough, once I create the map field, I can re-enable Command Palette and then I can continue creating Map fields without errors.

Thanks for the great plugin, I hope I can re-enable it soon.

hubertprein commented 6 years ago

I haven't had the chance to test this yet, but for now, you're the only one experiencing this "weird bug". When I get the time (might be the end of this week) I'll install that Simple Map plugin to see what's going on. I'll get back on this.

juresrpcic commented 6 years ago

Thanks, @hubertprein . You should be able to duplicate my error on a clean Craft 3 RC1 install doing these steps:

hubertprein commented 6 years ago

It's caused by the following check in the init function of the command palette: Craft::$app->getUser()->getIsGuest() That function somehow loads up a bunch of stuff, including the field type of SimpleMap. In my opinion, it shouldn't even be fired/called when checking a user status. I've brought it to Brandon's attention. We'll have to wait and see what he can say about it.

hubertprein commented 6 years ago

@juresrpcic It seems you have to be careful with the init function. Simply register for events, but do checks in the triggered Event rather than in the init function. In short; fixed in the latest release.