Skip to content

Marker appears on all maps with the last location in a Repeater field #124

@ssulima

Description

@ssulima

I'm using filament-map-picker inside a Repeater::make('locations') field, displayed with Tab::make for each location.

The problem is that when rendering multiple maps in the form, the marker for each map is always set to the location of the last map in the repeater. Each tab should show its own marker corresponding to its location, but currently, all maps show the same marker.

Example setup:

Repeater::make('locations')
    ->schema([
        Tab::make('Location Info')
            ->schema([
                Map::make('location')
                    ->afterStateHydrated(function ($record, Map $component): void {
                                  $component->state([
                                      'lat' => $record?->latitude ?? 52.229676,
                                      'lng' => $record?->longitude ?? 21.012229,
                                  ]);
                              })
                // other fields...
            ])
    ])

Expected behavior:

  • Each map should display a marker at its own saved location.

Actual behavior:

  • Every map displays a marker at the location of the last entry in the repeater.

It seems like the map picker is not properly scoped to each repeater item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions