Skip to content

Conversation

skryukov
Copy link
Contributor

Inertia temporary props are server-provided properties that should be available only for the next render and then be discarded. Inertia deliberately does not cache them in history. This gives you predictable one-time UI feedback and prevents stale data (like status messages ) from resurfacing when users navigate back/forward or when a cached page is reused.

Usage example (requires implementation in Laravel adapter):

    /**
     * Show the login page.
     */
    public function create(Request $request): Response
    {
        return Inertia::render('auth/login', [
            'canResetPassword' => Route::has('password.request'),
            'status' => Inertia::temp($request->session()->get('status')),
            // should we support Inertia::defer(...).temp, Inertia::optional(...).temp?
        ]);
    }

I believe this is a simple yet useful addition to the Inertia API, but you might want to keep the public API short, so before implementing the Laravel adapter PR, I'd love to hear your thoughts.

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.

1 participant