InvalidateSize dash leaflet

Hello every body,
I want to display a map in a modal. But the map is only partially displayed.
On the different threads, I see that I have to use the InvalidateSize function to load the map once the modal is opened. But I can’t do it.

I use this code in python file (This code is in a calback) :

ns = Namespace('dashExtensions', 'dashExtensionssub')
maps = dl.GeoJSON(data=geobuf, format="geobuf",
                     zoomToBounds=True,
                     options=dict(pointToLayer=ns('invalid_size')),
                    )

and my javascript file is :

   window.dashExtensions = Object.assign({}, window.dashExtensions, {
   dashExtensionssub: {
       invalid_size: function(feature, latlng) {
           var map = L.map('map')
           {return map.invalidateSize();}
       },
   },
});

What am I doing wrong ? Have you got an idea please ?

Erwan