resolver

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package resolver provides property resolution logic for Inertia. It handles partial reloads, deferred props, merge strategies, and infinite scroll.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestHeaders

type RequestHeaders struct {
	PartialComponent          string
	PartialOnly               string
	PartialExcept             string
	Reset                     string
	ExceptOnceProps           string
	InfiniteScrollMergeIntent string
}

RequestHeaders contains Inertia-specific request headers extracted from HTTP requests. These headers control partial reloads, prop filtering, and infinite scroll behavior.

type ResolveResult

type ResolveResult struct {
	// Props contains the final resolved page properties after filtering and evaluation.
	Props map[string]any

	// SharedProps lists the top-level keys that originated from shared props (via Share()).
	SharedProps []string

	// MergeProps lists prop paths the client should merge (append) into existing state.
	MergeProps []string

	// PrependProps lists prop paths the client should prepend into existing state.
	PrependProps []string

	// DeepMergeProps lists prop paths the client should deep-merge into existing state.
	DeepMergeProps []string

	// MatchPropsOn lists property keys used for item matching during merge operations.
	MatchPropsOn []string

	// DeferredProps maps defer group names to the prop paths belonging to each group.
	DeferredProps map[string][]string

	// ScrollProps contains per-prop pagination metadata for infinite scroll props.
	ScrollProps map[string]any

	// OnceProps contains per-prop metadata for once-resolved props, keyed by their once-key.
	OnceProps map[string]any
}

ResolveResult contains the fully resolved properties and metadata for an Inertia response. It is produced by Resolver.Resolve and consumed by the engine to build the Page object.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver resolves Inertia property values based on request headers and prop types.

func New

func New(isPartial, isInertia bool, headers *RequestHeaders) *Resolver

New creates a new Resolver configured for the given request type. isPartial indicates a partial reload request. isInertia indicates an Inertia request (vs. first-visit).

func (*Resolver) Resolve

func (r *Resolver) Resolve(
	ctx context.Context,
	shared, pageProps map[string]any,
) (*ResolveResult, error)

Resolve resolves all properties for the given shared and page props. It applies partial reload filtering, resolves lazy props, and collects metadata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL