inertia icon indicating copy to clipboard operation
inertia copied to clipboard

Add ability to mutate page props

Open vinnygambiny opened this issue 2 years ago • 2 comments

This PR allows mutating the page props with the usePage function.

This is for these situations https://github.com/inertiajs/inertia/discussions/78

You have only to do usePage().props.valueName = 'newValue'

vinnygambiny avatar Aug 01 '23 16:08 vinnygambiny

I don't think that should be a thing. Data which loaded the page should be accessible all the time, no matter what. In case you need it to be reactive and changeable - just create a custom reference that was initialized with the prop value.

punyflash avatar Aug 02 '23 07:08 punyflash

@punyflash there are definitely situations where this would be handy (eg. infinite loading), and Inertia should be more flexible about this.

innocenzi avatar Sep 06 '23 13:09 innocenzi

I'm closing this PR since the main use case discussed here and on #78 is supporting infinite scrolling. That's already coming to v2.0 soon, as you can see in Taylor's Laracon keynote 🚀

pedroborges avatar Sep 04 '24 14:09 pedroborges