With current version of PageForms (3f4a5866) with MediaWiki 1.37.0-alpha (ec0be22116) (but also reproductible with PF 5.1 + MW 1.33), when an autoedit should modify the last instance (or adds an instance) of a multi-instance template, it sometimes modify the first instance of the said template. See also relevant doc of this feature.
The exact caracterization could be improved, but here is a reproductible example.
PFtest:
{{PFtemplate |type=sky |colorSky=blue }} {{PFtemplate |type=water |colorWater=azul }} {{PFtemplate |type=wood |defaultColor=brown }}
Template:PFtemplate:
The {{{type|…}}} is {{#switch:{{{type|}}} |sky = {{{colorSky|{{{defaultColor|…}}}}}}, which is beautiful |water = {{{colorWater|{{{defaultColor|…}}}}}}, which is nice |wood = {{{colorWood|{{{defaultColor|…}}}}}}, which is dark |#default = {{{defaultColor|…}}} }}.
Form:PFform:
{{{for template|PFtemplate|multiple|add button text=Add a template}}} * Type : {{{field|type|input type=text}}} * Color (sky) : {{{field|colorSky|input type=text}}} * Color (water) : {{{field|colorWater|input type=text}}} * Color (wood) : {{{field|colorWood|input type=text}}} * Color (default) : {{{field|defaultColor|input type=text}}} {{{end template}}} ---- {{{standard input|save}}} {{{standard input|cancel}}}
PFautoedit:
{{#autoedit:form=PFform|target=PFtest|link text=Modify the wood|query string=PFtemplate[2][colorWood]=dark brown}}
When you click on the autoedit button, you obtain the following diff:
@@ -2,4 +2,5 @@ |type=sky |colorSky=blue +|colorWood=dark brown }} {{PFtemplate @@ -9,4 +10,5 @@ {{PFtemplate |type=wood +|colorWood=dark brown |defaultColor=brown }}
It should instead be the following diff since the autoedit is instructed to modify the third instance of the template:
@@ -9,4 +9,5 @@ {{PFtemplate |type=wood +|colorWood=dark brown |defaultColor=brown }}
PS: azul is blue in Portuguese, one of the sole words I know in this language thanks to Cesaria Evora in the song Mar azul :)