liqd / a4-meinberlin

The central participation platform of the city of Berlin, Germany
https://mein.berlin.de
GNU Affero General Public License v3.0
40 stars 6 forks source link

Map is broken, I can't add an idea to test the moderation #5582

Closed mcastro-lqd closed 7 months ago

mcastro-lqd commented 8 months ago

URL: https://meinberlin-design-dev.liqd.net/budgeting/create/module/burgerinnenhaushalt-2-phasen-12/ user: moderator/initiator/Admin expected behaviour: to be able to add the pin in the map behaviour: Map is grey and not clickable important screensize: Both device & browser: Safari

Screenshot 2024-03-27 at 09 50 21
goapunk commented 7 months ago

Somehow this is caused when the webpack prod config is used or the node_env is set to 'production'. Can be replicated by adding optimization: { nodeEnv: 'production' } to webpack.dev.js . I don't really know what's the problem. Have you seen anything like that before @vellip @hom3mad3 ?

vellip commented 7 months ago

Ohh, interesting. Can't say I have. Does it log anything to the console?

goapunk commented 7 months ago

@vellip nothing I could see, it's super weird

vellip commented 7 months ago

@goapunk seems to work when I set the center prop on the map

goapunk commented 7 months ago

@vellip do you know why it fixes it ? :sweat_smile: and would you create a PR if you have time ? :)

goapunk commented 7 months ago

@CarolingerSeilchenspringer should we prioritize this as it makes testing of anything which requires choosing a point on a map impossible? (e.g. you can't create any mapideas, proposals,...)

vellip commented 7 months ago

@vellip do you know why it fixes it ? 😅 and would you create a PR if you have time ? :)

Ah sorry. I am not sure. I think the map needs a center before it works but I can't explain why it would only be the case in production mode. I'd have to have a closer look, which would probably take more time than I can offer this week. A quick fix would probably just be to set center={[0,0]} and the code should after initiation jump to either the marker or polygon (if set) anyway.

goapunk commented 7 months ago

@vellip no worries, I can also push a temporary fix for now. Setting the center doesn't work because somehow the order of execution seems different. The callback which sets the polygon center is called before the map reference is created, so it doesn't do anything as there's no map yet (at least that's what seemed to happen)