Comments (8)
@lepikhinb The issue is that inertia only filters out lazy prop one level deep
$props = ($only && $request->header('X-Inertia-Partial-Component') === $this->component)
? Arr::only($this->props, $only)
: array_filter($this->props, static function ($prop) {
return ! ($prop instanceof LazyProp);
});
So that means that under 'modal.props' they will always be evaluated because they won't be filtered
So for this to work you filter the lazy props yourself before sharing them, I'll make a PR
from momentum-modal.
It would be great if something like this worked. I can think of many situations where functionality like this is needed, like refreshing a dropdown or something.
from momentum-modal.
This should already work, as it just utilizes the Inertia's share
method to pass modal props.
inertia()->share(['modal' => $this->component()]);
protected function component(): array
{
return [
'props' => $this->props,
...
];
}
from momentum-modal.
Running into this today.
I'm trying to get data after the initial page load using Inertia.reload({ only: ['jobsForDropdown'] })
on the front end.
public function edit(Project $project)
{
return Inertia::modal('Projects/Jobs/Edit', [
'jobsForDropdown' => Inertia::lazy(
fn () => SomeService::getJobs()
->map(fn ($p) => [
'value' => $p['id'],
'label' => $p['name']
])
),
...
])->baseRoute('projects.edit', $project);
}
It's always there. Even on first load :S.
from momentum-modal.
I have the same problem as @funkymonk91. When reloading data with Inertia::reload({only: ['var1', 'var2']});
, it won't update the data.
from momentum-modal.
Btw unrelated, can I ask, why did you add basePageRoute
in 08aea53 ? It's the same function as baseRoute
didn't you mean to create as baseUrl
method instead
from momentum-modal.
@Tofandel it replicates the method from the official implementation that was never released yet.
from momentum-modal.
Hi, I noticed lazy props are not possible with the modal thingy:
public function create(): Modal { return Inertia::modal('Admin/Classrooms/Create') ->with([ 'closureLazy' => fn () => User::all(), 'inertiaLazy' => Inertia::lazy(fn () => User::all()), ]) ->baseRoute('admin.classrooms.index'); }
How difficult is to add this behaviour, does it differ much from the original behaviour that Inertia has?
P.S. Love your work.
Hi, I have the same issue. Did you manage to get it work?
from momentum-modal.
Related Issues (20)
- Cannot read properties of null (reading 'props') HOT 4
- Modal/Slide-over resets form fields HOT 1
- How to show Modal from another Modal HOT 2
- Could not resolve "@inertiajs/vue3" HOT 3
- Possible to pass a URL to redirect function? HOT 1
- baseRoute component rerender every time
- Any example on how to use it with Svelte?
- Header X-Inertia-Modal-Redirect - CORS issue
- Call to a member function with() on null HOT 1
- Cannot read properties of null (reading 'props') HOT 1
- [Question] Possible to prevent reloading if already open?
- TypeScript typings HOT 1
- Problem with Inertia forms HOT 1
- Need to @click='close' when using links inside modals? HOT 4
- Modal 404s When Accessing Again
- Demo page incorrect password
- Refresh the baseRoute page data HOT 2
- Base Component resets state when opening the modal
- Please support inertia-laravel v1.0
- How to use preserve state on close correctly? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from momentum-modal.