Skip to content

Commit 4b90deb

Browse files
authored
fix #1516, check inertia component array key (#1525)
1 parent 0f74197 commit 4b90deb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DataCollector/ViewCollector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public function addView(View $view)
6868
// Prevent duplicates
6969
$hash = $type . $path . $name . $this->collect_data ? implode(array_keys($view->getData())) : '';
7070

71-
if (class_exists('\Inertia\Inertia') && isset($data['page'], $data['component'])) {
72-
$data = $data['page'];
73-
$name = $data['component'];
71+
if (class_exists('\Inertia\Inertia') && isset($data['page']['props'], $data['page']['component'])) {
72+
$name = $data['page']['component'];
73+
$data = $data['page']['props'];
7474

7575
if (!@file_exists($path = resource_path('js/Pages/' . $name . '.js'))) {
7676
if (!@file_exists($path = resource_path('js/Pages/' . $name . '.vue'))) {
@@ -106,7 +106,7 @@ public function addView(View $view)
106106
}
107107

108108
if ($this->collect_data === 'keys') {
109-
$params = array_keys($view->getData());
109+
$params = array_keys($data);
110110
} elseif ($this->collect_data) {
111111
$params = array_map(
112112
fn ($value) => $this->getDataFormatter()->formatVar($value),

0 commit comments

Comments
 (0)