fix: marker title displayed immediately on creation

- Return title directly instead of reading from page object
- Prevents showing identifier/slug before reload
- New markers now display "Marqueur [index]" immediately in list
- Also return num directly for consistency

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-01-29 16:27:06 +01:00
parent 75d3b557fe
commit 68d3142126
4 changed files with 20644 additions and 645 deletions

View file

@ -155,15 +155,16 @@ return [
->filterBy('intendedTemplate', 'marker');
$nextNum = $existingMarkers->count() + 1;
// Generate unique slug
// Generate unique slug and title
$slug = 'marker-' . time();
$title = 'Marqueur ' . $nextNum;
// Create the new marker page
$newMarker = $mapPage->createChild([
'slug' => $slug,
'template' => 'marker',
'content' => [
'title' => 'Marqueur ' . $nextNum,
'title' => $title,
'latitude' => $lat,
'longitude' => $lon
]
@ -178,13 +179,13 @@ return [
'marker' => [
'id' => $newMarker->id(),
'slug' => $newMarker->slug(),
'title' => $newMarker->title()->value(),
'title' => $title,
'position' => [
'lat' => $lat,
'lon' => $lon
],
'num' => $newMarker->num(),
'panelUrl' => '/panel/pages/' . $newMarker->id()
'num' => $nextNum,
'panelUrl' => (string) $newMarker->panel()->url()
]
]
];