From 599efd7350c6f48166ffeeaf0e6ff32a2b5cf5b6 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Wed, 3 Jul 2024 11:44:30 +0200 Subject: [PATCH] docs: Add note about opting out of partials (#2572) --- docs/latest/concepts/partials.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/latest/concepts/partials.md b/docs/latest/concepts/partials.md index bfe7a93e..5ef2d8b2 100644 --- a/docs/latest/concepts/partials.md +++ b/docs/latest/concepts/partials.md @@ -196,3 +196,33 @@ export default function LogView() { > [info]: When picking the `prepend` or `append` mode, make sure to add keys to > the elements. + +## Bypassing or disabling Partials + +If you want to exempt a particular element from triggering a partial request +like on a particular link, form or button, you can opt out of it by setting +`f-client-nav={false}` on the element or one of the ancestor elements. + +```tsx + + {/* This will cause a partial navigation */} + With partials + + {/* This WONT cause a partial navigation */} + No partials + + {/* This WONT cause a partial navigation on any elements below */} +
+
+ No partials +
+
+; +``` + +Whenever an element is clicked Fresh checks if it has the `f-client-nav` +attribute and if it is set to `true`. If the element itself doesn't have such an +attribute, it will check if any of the ancestor elements has it. If an element +was found with a truthy `f-client-nav` attribute a partial request will be +triggered. If there is no such attribute or if it's set to `false`, no partial +request will occur.