Skip to content

fix #1516, check inertia component array key #1525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

erikn69
Copy link
Contributor

@erikn69 erikn69 commented Feb 14, 2024

fix #1516

@barryvdh
Copy link
Owner

Should page.component also be used then?

@erikn69
Copy link
Contributor Author

erikn69 commented Feb 14, 2024

No, page.component means ['page' => ['component' => 'filename'] ]

#1523 (comment)

it's assuming that if there is a key page, it is an array and it also has a child key page.component

@@ -68,7 +68,7 @@ public function addView(View $view)
// Prevent duplicates
$hash = $type . $path . $name . $this->collect_data ? implode(array_keys($view->getData())) : '';

if (class_exists('\Inertia\Inertia') && isset($data['page'], $data['component'])) {
if (class_exists('\Inertia\Inertia') && isset($data['page'], $data['page']['component'])) {
$data = $data['page'];
$name = $data['component'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should this be $data['page']['component'] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah okay, that's what I meant :P I'm just not sure how the Inertia config looks like. Don't have a demo project ready, but will try.

Copy link
Contributor Author

@erikn69 erikn69 Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same problem, i just follow user indications
#1389 (comment)
image
You could add the other keys(props/version) for more security, although I think it would not be necessary

@erikn69
Copy link
Contributor Author

erikn69 commented Feb 14, 2024

I did install Inertia on a fresh laravel app

With 'views.data' => 'keys',
image

With 'views.data' => true,
image

@barryvdh barryvdh merged commit 4b90deb into barryvdh:master Feb 14, 2024
@erikn69
Copy link
Contributor Author

erikn69 commented Feb 14, 2024

Wait, Now that I'm investigating Inertia, I see that there are some things missing to have full support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants