Draw function crashes after clicking on popups. Uncaught TypeError: t.sourceTarget.getPopup is not a function

i am getting the following error on the browser console when using streamlit-folium:

Uncaught TypeError: t.sourceTarget.getPopup is not a function

The drawing plug in stops working when i click on a marker with a popup. I have to reload the page and use the drawing function without clicking any object in order for the drawing function to keep on working. The moment i click a marker with a popup, the output reloads, and when i try to draw or delete the last active drawing, pum i get the error in the console and the map wont reload upon finished drawings.

                    map_gebiet = folium.Map(
                        location=[random_lat, random_lon],
                        zoom_start=7,
                        key=f"folium-map-area-{production_development}",
                    )

                    Draw().add_to(map_gebiet)
                    
                    folium.CircleMarker(
                        location=[lat_marker, lon_marker],
                        radius=radius,
                        color='#1D1D1B',
                        fill=True,
                        fill_color='#2E55A5',
                        tooltip=folium.Tooltip(
                            html_tooltip,
                            permanent=True,
                            direction='right',
                            offset=(60,0)
                        ),
                        popup="popup",
                        fill_opacity=0.2,
                        z_index_offset=700
                        #pane="circle_layer",
                        #z_index_offset=700

                    ).add_to(map_gebiet)

                    map_gebiet_output = st_folium(
                        map_gebiet,
                        use_container_width=True,
                        returned_objects=[
                            "all_drawings",
                            #"last_object_clicked",
                            "last_active_drawing"
                        ], #last_clicked, last_object_clicked, last_object_clicked_tooltip, last_object_clicked_popup, all_drawings, last_active_drawing
                        height=height,
                        #key=f"leaflet-objekt-area-{production_development}",

                    )

Any popup
image
Polygon never closes


Error message displays in the console when trying to close a drawing or when trying to delete a drawing.

i think its because when i click on a marker the map expects the same elements of the same layer

But when after clicking the popup at first