diff --git a/README.md b/README.md index 38e78e0..253038a 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ ctx := inertia.SetEncryptHistory(r.Context()) Clear history: ```go -ctx := inertia.SetClearHistory(r.Context()) +ctx := inertia.ClearHistory(r.Context()) // pass it to the next middleware or inertia.Render function using r.WithContext(ctx). ``` diff --git a/context.go b/context.go index 2003e35..bb54e14 100644 --- a/context.go +++ b/context.go @@ -97,8 +97,8 @@ func EncryptHistoryFromContext(ctx context.Context) (bool, bool) { return encryptHistory, ok } -// SetClearHistory cleaning history state. -func SetClearHistory(ctx context.Context) context.Context { +// ClearHistory cleaning history state. +func ClearHistory(ctx context.Context) context.Context { return context.WithValue(ctx, clearHistoryContextKey, true) } diff --git a/context_test.go b/context_test.go index 47b8286..390b0a6 100644 --- a/context_test.go +++ b/context_test.go @@ -473,10 +473,10 @@ func Test_EncryptHistoryFromContext(t *testing.T) { } } -func TestInertia_SetClearHistory(t *testing.T) { +func TestInertia_ClearHistory(t *testing.T) { t.Parallel() - ctx := SetClearHistory(context.Background()) + ctx := ClearHistory(context.Background()) got, ok := ctx.Value(clearHistoryContextKey).(bool) if !ok { diff --git a/response.go b/response.go index 89a40a5..4fc276b 100644 --- a/response.go +++ b/response.go @@ -19,7 +19,7 @@ type TemplateFuncs map[string]any // and will be available in the front-end component. type Props map[string]any -// OptionalProp is a property that will evaluate then needed. +// OptionalProp is a property that will evaluate when needed. // // https://inertiajs.com/partial-reloads type OptionalProp struct { diff --git a/response_test.go b/response_test.go index 191449f..d72bcbf 100644 --- a/response_test.go +++ b/response_test.go @@ -283,7 +283,7 @@ func TestInertia_Render(t *testing.T) { ctx := r.Context() ctx = SetEncryptHistory(ctx, true) - ctx = SetClearHistory(ctx) + ctx = ClearHistory(ctx) err := I().Render(w, r.WithContext(ctx), "Some/Component") if err != nil {