Problem component SWITCH, on_turn_off. Cannot activate web_browser

Here is my current code for this component

switch:
  - platform: template        # "Cabane   light"
    name: "1 Cabane Light"
    optimistic: true  # ESPHome to assume that the switch state is what you last set it to
    on_turn_on:
      lambda: |-
         ESP_LOGI("LoRa", "turn_on_action");
         std::get<7>(id(station_data_list)[0]) = true;          // Update light state
         // For Cabane there is no need to send a packet, it is not possible to receive it
         id(my_display).update();                               // Update the display
    on_turn_off:
      lambda: |-
         ESP_LOGI("LoRa", "turn_off_action");
          std::get<7>(id(station_data_list)[0]) = false;        // Update light state
          // For Cabane there is no need to send a packet, it is not possible to receive it
          //  id(my_display).update();                              // Update the display

In the on_turn_off action, id(my_display… is commented out. My code can compile and a can see my component on the web_server.
As soon, as I uncomment this last line. My code compile and the code can be uploaded to my esp32 device but web_server can not be use.
I try many configuration but as soon as I try to update or trying to execute a SCRIPT, i cannot get to the web_browser.

I pretty sure you get more support if you post the code that causes the problem and some logs showing what’s going on…

This is exactly the code that cause the problem. Uncomments the last line and try to execute any script and web_browser become not available. The code compile. My program has over 400 lines and is very specific. It is designed for a Lilygo LoRa to send and receive packets over long distance. It work very well. I am just adding code to send commands to start/stop relay over 2 kilometres away. I could try to reproduce the problem with a simplify program. I doubt that sending my whole program would help. It required at least 2 remote units, used custom component.