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()
    {    
        
        $post=$this->post;  
        $mapperClasse = $this->SM->get('TCLASSE'); 
        $hydrator = new ArraySerializableHydrator();
        $classe  = new \Commun\Model\Entity\Classe();
        
        $form = $this->formManager->get(\Admin\Form\Parametrage\ClasseForm::class);              
        $form->bind($classe)->setInputFilter($classe->getInputFilter())->setData($post);           
        if(!$post){
            return new ViewModel(['form' => $form,'user' => $this->user]);
        }        
        
        if(isset($post['enregistrer'])){    
            if(!$form->isValid()){
                $this->FLASH()->showMessage($this->TRANSLATOR()->translate('form-contient-donnees-erronees'),'danger');
                return new ViewModel(['form' => $form,'user' => $this->user]);
            }
            $mapperClasse->beginTransaction(); 
            try{                   
                $data = $hydrator->extract($classe);
                $additionnalData = [
                    'dateSaisie' => date('Y-m-d H:i:s'),
                    'idRefUtilisateur' => $this->user->getIdRefUtilisateur(),
                ];
                $mapperClasse->insert($data,$additionnalData);
                $mapperClasse->commit();
            }catch (\Exception $e){  
                $mapperClasse->rollBack(); 
                $this->FLASH()->showMessage($this->TRANSLATOR()->translate($e->getMessage()),'danger');                                               
                return new ViewModel(['form' => $form,'user' => $this->user]);
            }    
            $this->FLASH()->showMessage($this->TRANSLATOR()->translate('form-successful'));
            return $this->redirect()->toRoute('administration-parametrage', ['action' =>  'liste-des-classes']);
        }
                
    }

The code for redirection is

$this->FLASH()->showMessage($this->TRANSLATOR()->translate('form-successful'));
return $this->redirect()->toRoute('administration-parametrage', ['action' =>  'liste-des-classes']);

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

<?php
/**
 *
 * @module    Application
 * @subpackage View
 * @author     Samuel NANGUI <nanguisamuel@gmail.com>
 * @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']));
$form->prepare();
$classeForm = $form->get('ClasseForm');
?>
      
<div class="container-fluid inner-starter">                                
    <?=$this->partial('partial/commun/view-header',[
        '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">
                <?=$this->partial('partial/commun/view-rendering-datatable',[
                    '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'
                    ])?>       
            </div>
        </div>        
    </div>
    
    <?=$this->form()->openTag($form)?> 
    <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>
        </div>          
    </div>      
    <div class="mt-4 mb-4">
        <?=$this->partial('partial/commun/view-rendering-buttons',['form' => $form,'buttons' => ['enregistrer','','',''],'col' => 3])?> 
    </div>  
    <?=$this->form()->closeTag();?>
    
</div>

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>
        </div>
    </div>
    <?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>
        </div>
    </div>
    <?php endif; ?>
</div>
<?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