Skip to content
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

Add undefined as a valid option FormDataConvertable #1165

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

hailwood
Copy link
Contributor

@hailwood hailwood commented May 3, 2022

Doing a reload and sending across undefined explicitly for a key in data works, it will remove it from the url.
But the type doesn't allow it

E.g. the following works in straight js

// page is /hello

Inertia.reload({data: {test: 5}});
//page is now /hello?test=5

Inertia.reload({data: {test: null}});
//page is now /hello?test=

Inertia.reload({data: {test: undefined}});
//page is now /hello

Doing a reload and sending across `undefined` explicitly for a key in data works, it will remove it from the url.
But the type doesn't allow it

E.g. the following works in straight js
```js
// page is /hello

Inertia.reload({data: {test: 5}});
//page is now /hello?test=5

Inertia.reload({data: {test: null}});
//page is now /hello?test=

Inertia.reload({data: {test: undefined}});
//page is now /hello
```
@reinink reinink merged commit 271ea2a into inertiajs:master Jun 27, 2022
@reinink
Copy link
Member

reinink commented Jun 27, 2022

@hailwood dig it — thanks!

@reinink reinink mentioned this pull request Sep 9, 2022
15 tasks
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