Consider Views persistence state as SPA requires

Hi everyone,
Is there a mechanism to keep the state of views?

I don't understand why the only way is to use this:

Application.CreateForm (AInstanceClass, 'MAINCONTAINER', MyForm, @MyFormCreated)

whenever I need this view (MyForm), and can't create it once and then use MyForm instance when i need it.

It is very penalizing to keep everything that happens on a view and push all the data again to the new instance.

Maybe I didn't understand anything at all about how it works !!!

And because of that, if I want to use an external framework (Vues, ....) to keep states, I can't.

Please help me on this.

Thank you.

How exactly do you try to create this once and use when you need it and what exactly goes wrong when you try to do so?

=> this is my long response in aproximativ english

With TMS web Core VS, I use principaly HTML templates and map some

with TWebHTMLDiv or with TWebButton not so much.

I use a MainForm (entry of my program) with a main menu to manage all. It mean's when I choose to change some View, I use a function to save datas and states components of the form I came from and I call aLaunchForm function (based on TMS example) to create each form.

I've simplified this launchform function :

procedure TMainForm.LaunchForm(AInstanceClass: TFormClass);
var
aHomeAsked,
aView1Asked : boolean;

// --- HOME
procedure HomeFormCreated(AForm: TObject);
begin
THomeForm(AForm).Show;
end;

// --- View1
procedure View1FormCreated(AForm: TObject);
begin
TGrpForm(AForm).Show;
end;

begin
if Uppercase(Application.ActiveForm.ClassName) <> Uppercase(AInstanceClass.ClassName) then
begin
// WHO'S
aHomeAsked := (Uppercase(AInstanceClass.ClassName) = 'THOMEFORM');
aView1Asked := (Uppercase(AInstanceClass.ClassName) = 'TVIEWFORM');

  //  (fHomeForm, fView1Form are global variables)
  if aHomeAsked then Application.CreateForm(AInstanceClass, 'H_MAIN', fHomeForm, @HomeFormCreated)
    else if aView1Asked then Application.CreateForm(AInstanceClass, 'H_MAIN', fView1Form, @View1FormCreated)
		else ......
end;

end;

Each time I use this LaunchForm function to go call a form already launched before I loss the last form
properties.

Is there some method to create a form and have a full persistence of it as pascal/delphi normal form.

When I create a form in pascal I always get the instance back in the same state as when I leave it.

Is it possible with TMS Web Core ???
If yes what's the good method.

Thank you.

Try to toggle form.Visible: boolean instead

Not working.

Menu
--- Option1 (form1)
--- Option 2 (form2)

From start when click on
Option 1 if first time = Application.CreateForm(...)

after click on
Option 2 if first time = Application.CreateForm(...)

after click back on Option1 = form1.visible := true (black screen)
even if I try with Option2.visible := false before.

Could you please help me ?

PS:
When I try Application.Navigate('',ntPage) browser create a new blank page. I would like to stay on same page.

Thank you