Comments (5)
It sounds more like something that would be on the client side. Perhaps on the client side you could do something like $inertia.clear('auth')
which will remove it from the request header to the backend. So from the servers point of view it would return the data.
from inertia-laravel.
I can see why this might be useful.
One thing to consider would be how to "re-share" information that you have shared with the proposed shareOnce
method.
For example, if you are sharing user details the once and they updated their username, email, name etc you would want that to then be re-shared. So in that instance the implementation would need to overrule the request header saying that the information is already on the client side.
from inertia-laravel.
yep, re-share is a bit tricky, not sure if there is an elegant solution.
from inertia-laravel.
@reinink would like to know your thoughts on it.
from inertia-laravel.
Hey folks! My gut reaction is that this feels like too much complexity for what you gain in performance. Passing the currently authenticated user on each request is adding very little overhead, and typically this shared data is pretty minimal.
For most apps it will include:
- The current user
- Flash data (only when they exist)
- Errors (only when they exist)
I like to think of Inertia like a server-side framework. With a classic server-side framework, literally each page load you send the entire site template on each request, which includes the currently authenticated user (ie. in the header). And, that's a totally accepted way of doing things. So passing a little extra JSON in each Inertia request seems fine too. In fact, it's obviously way better than a classic server-side rendered app, since the entire template isn't being resent each time.
This is something we can always revisit in the future. 💪
from inertia-laravel.
Related Issues (20)
- Router events runs multiple times. HOT 5
- JSON response error on subdomains - Firefox HOT 1
- Inertia with supervisor SSR error HOT 1
- SSR (react) error ui doesn't match initial ui when including prop having html
- ✨Feature Request: Support `ziggy` 2.0 HOT 4
- fails testing nested pros
- External JS files not working unless you manually reload the page HOT 1
- image upload help HOT 2
- Laravel 11 support HOT 2
- There is no automatic follow protocol, http is used under https, how to solve it HOT 4
- Laravel 11 update and Nova issue HOT 2
- Vue Watch not working upon redirect route HOT 2
- Problem with SSR HOT 1
- Force app.blade.php to reload HOT 2
- Should Inertia middleware call session()->setPreviousUrl? HOT 6
- - HOT 1
- redirection to /dashboard after login does not work HOT 1
- Prevent a webpage from navigating away HOT 1
- Release notes for 1.0 could make it more clear that "Fix URL generation (#592)" is a breaking change HOT 5
- Ziggy2.0 and Laravel11 and Breeze for Inertia + React, TypeScript and SSR starter kit throws error on initial setting HOT 2
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 inertia-laravel.