Laminas Flash messenger is shown twice

My problem is that when I call flash messenger plugin in my controller, it works. But the same message appears when I open an another page.
I would like to know how to avoid it?

What does it mean that it works? Is there a redirection that leads to a new HTTP request or will the current messages be rendered in the same request?

Thank you @froschdesign ,
Let me post a sample of my code to explain to be most clear

Here is for instance in my controller ab action :

public function listeDesClassesAction()
        $mapperClasse = $this->SM->get('TCLASSE'); 
        $hydrator = new ArraySerializableHydrator();
        $classe  = new \Commun\Model\Entity\Classe();
        $form = $this->formManager->get(\Admin\Form\Parametrage\ClasseForm::class);              
            return new ViewModel(['form' => $form,'user' => $this->user]);
                return new ViewModel(['form' => $form,'user' => $this->user]);
                $data = $hydrator->extract($classe);
                $additionnalData = [
                    'dateSaisie' => date('Y-m-d H:i:s'),
                    'idRefUtilisateur' => $this->user->getIdRefUtilisateur(),
            }catch (\Exception $e){  
                return new ViewModel(['form' => $form,'user' => $this->user]);
            return $this->redirect()->toRoute('administration-parametrage', ['action' =>  'liste-des-classes']);

The code for redirection is

return $this->redirect()->toRoute('administration-parametrage', ['action' =>  'liste-des-classes']);

Here is my view liste-des-classes.phtml;

 * @module    Application
 * @subpackage View
 * @author     Samuel NANGUI <>
 * @copyright  Copyright (c) 2021 Nslabs
$this->headTitle($this->translate('Administration - '.$this->translate('liste-des-classes-title')));
echo $this->partial('partial/commun/header-datatable');
$form->setAttribute('action', $this->url('administration-parametrage', ['action' => 'liste-des-classes']));
$classeForm = $form->get('ClasseForm');
<div class="container-fluid inner-starter">                                
        'flash_redirect' => true,
        'titre' => $this->translate('liste-des-classes-title'),
        'description' => $this->translate('liste-des-classes-desc'),
    <div class="row-fluid wrapper box-shadow mb-20">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 onglets-container bloc-violet-border mb-30 bloc2 div-datatable">
            <h5 class="titre-datatable-desc-violet"><img class="icon-datatable" src="<?=$this->basePath('/images/classes.svg')?>"><span class="titre-datatable-desc-violet font-14"><?=$this->translate('liste-des-classes-title')?></span></h5>            
            <div class="p-4 responsive mb-5 col-sm-12 table-borderless table-responsive bloc-center nowrap datatable-violet">
                    'nbreCols'  => 7,
                    'tableId'   => 'dt-liste-des-classes',
                    'dataType'  => ['dataLibre','dataLibre','dataLibre','dataLibre','dataDateTime','dataLibre','dataAction'],
                    'sizeCol'   => [15,15,15,10,15,20,10],
                    'colTitle'  => ['intitule-abrege','intitule','groupe-classe','ordre','date-saisie','saisie-par','Action'],
                    'dAlign'    => ['left','left','left','center','right','left','center'],
                    'bodyClass' => 'font-13'
    <h6 class="title-header mt-10"><?=$this->translate('ajouter-classe')?></h6>
    <div class="row clearfix">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 mb-30 mt-20">            
            <div class="p-30 box-shadow bloc-vert-border bloc2 form-input">                                                                                                   
                <?=$this->partial('partial/commun/view-rendering-elements',['form' => $classeForm,'colLabel'=>4,'colInput'=>8,'setLabel'=>true])?>                                                           
    <div class="mt-4 mb-4">
        <?=$this->partial('partial/commun/view-rendering-buttons',['form' => $form,'buttons' => ['enregistrer','','',''],'col' => 3])?> 

The partial view-header.phtml

<?php if(isset($this->titre)): ?>
<div class="row">
    <div class="col-12">
        <div class="page-title-box d-sm-flex align-items-center justify-content-between">
            <h4 class="mb-sm-0 font-size-18"><?=$this->titre?></h4>
    <?php if(isset($this->description)): ?>
    <div class="col-12">
        <div class="page-title-box d-sm-flex align-items-center justify-content-between">
            <p class="description-title"><?=$this->description?></p>
    <?php endif; ?>
<?php endif; ?>
<?php if($this->flash_redirect): ?>
    <?= $this->flashMessenger()->renderCurrent('default', [], false);?>
<?php endif; ?>

Here are my codes blocks

What I’m trying to do is :

When I post the form and process it in the controller, the successful message is shown clearly. And when for instance I refresh the page, the message still appear. When a try again the message now disapear.

You use a custom controller plugin with a custom flash messenger. The original flash messenger sets (by default) an expiration hops of 1 for the session container, so that the messages are not transported further than to the next request. Maybe your implementation is different.

And you use renderCurrent in your view script for messages that come from the previous request, but the method is intended for fetching messages from the current request.

(And please reduce your code snippets, there is just too much that is off topic. Then it will be easier to help. Thanks!)

Ok thank you @froschdesign