code: public function onKernelResponse(FilterResponseEvent $event): void
      {
          if (!$event->isMasterRequest()) {
              return;
          }
  
          $request = $event->getRequest();
  
          if ($request->isMethod('POST')) {
              return;
          }
  
          if (null === ($session = $request->getSession()) || !$session->isStarted()) {
              return;
          }
  
          $this->clearLegacyAttributeBags('FE_DATA');
          $this->clearLegacyAttributeBags('BE_DATA');
          $this->clearLegacyFormData();
      }
docs: Clear the Contao session data if not a POST request.