filterFields not work when page load

Repeater fields through filterFields are not updated when the page is loaded, if the dependsOn event occurs, the Repeater fields through filterFields are updated. In version 3.3.3 everything worked. Current version 3.3.6
Everything worked for me until the last updates, the data was loaded, and a repeater was formed on their basis. Now the repeater is updated only after dependsOn, although both events are processed in the debug, but in one case, update fields are not added, and when refresh is added, although the methods are identical, what is the problem with help pliz …

Hi @Cryden

Please share your filterFields() method code.

There was a bug fix in v3.3.3 to the repeater that could have broken your implementation, especially if it sets $_POST values trying to populate the repeater. Instead you should set it via $fields->myfield->value, which is fixed now.

Hopefully this makes sense!

public function filterFields($fields, $context)
{
    // Add Namespace Field
    if (isset($fields->parent)) {
        $val = $fields->parent->value;

        if ($val != null and $context == 'refresh') { <-- its work !!!
            $parent = Template::find($val);

            if ($fields->is_nested->value) {
                $all_parents = $parent->getParentsAndSelf();
            } else {
                $all_parents = $parent->getParents();
            }

            $parent_fields = [];
            $current_fields = [];
            $fields_value = isset($fields->fields->value) ? $fields->fields->value : [];

            foreach ($fields_value as $item) {
                $current_fields[$item['field_name']] = $item;
            }

            foreach ($all_parents as $item) {
                if (!$item->is_node) {
                    $parent_fields[$item->code] = [
                        'field_name'    => $item->code,
                        'field_label'   => $item->name,
                        'field_relation_model' => strval($item->id),
                        'field_required' => strval($item->is_required),
                        'field_nested' => strval($item->is_nested),
                        '_group' => 'parent'
                    ];
                }
            }

            $current_value = array_values(array_merge($current_fields, $parent_fields, $current_fields));
            $fields->fields->value = $current_value;
        }

        if ($val != null and $context == 'update') { <-- this not work
            if ($fields->is_nested->value) {
                $all_parents = $this->getParentsAndSelf();
            } else {
                $all_parents = $this->getParents();
            }

            $parent_fields = [];
            $current_fields = [];
            $fields_value = isset($fields->fields->value) ? $fields->fields->value : [];

            foreach ($fields_value as $item) {
                $current_fields[$item['field_name']] = $item;
            }

            foreach ($all_parents as $item) {
                if (!$item->is_node) {
                    $parent_fields[$item->code] = [
                        'field_name'    => $item->code,
                        'field_label'   => $item->name,
                        'field_relation_model' => strval($item->id),
                        'field_required' => strval($item->is_required),
                        'field_nested' => strval($item->is_nested),
                        '_group' => 'parent'
                    ];
                }
            }

            $current_value = array_values(array_merge($current_fields, $parent_fields, $current_fields));

            $fields->fields->value = $current_value;
        }
    }
}

Thanks @Cryden, I’m not sure this code would work in v3.3.3, however, there will be a new fix for this in v3.3.7 coming soon.

Thanks. See please theme DependsOn in Repeater Form Widget

In 3.3.7 all work normaly)))