Bit confused about getting frontend to leave anchor links alone.
Precicate to check if the anchor click event default action
should be ignored. This logic will ignore the event
if anchor href matches the route tree, and in this case
the page location is updated using History API.
but using ignore-anchor-click? all my anchor links just take me to a blank page instead of navigating on-page to where they should. Have replaced them with scroll-to events instead which is ok but seems a bit silly
:ignore-anchor-click? (constantly true)
did the trick, but still a bit confused then on the purpose of the included pred - why'd one ever want to let reitit start a navigation event and suppress on-page nav when there's no router match but an anchor is available? Seems nonintuitive, might be wise to have docs clarify a bit there.
@joen.tolgraven As the docs say, it will only affect anchors which match the route tree.
that was not my experience. If it did that would've made total sense!
That's how it is written, though bugs are possible. But if is ignoring the default handler, you should see the on-navigate call and the match from the handled anchor.
If the match is nil and on-navigate is called something is broken, if match is not empty, your route tree is somehow matching the anchor (not-found route or something)
Cheers, bug makes a lot more sense yeah. Have since changed route tree and can't replicate with current setup, will have a look back later. Match wasn't nil but :name was. No fallback routes. Will try investigate
Hey,
I'm using the coerce-response-middleware
middleware to validate the response returning from the API. My question is as follows:
• I'm doing some logic which is related to the response I'm returning in the :handler
endpoint
• I want to be able to do this logic after the coerce-response-middleware
is happening, to be sure that the response is valid
How do I accomplish that?
@ikitommi Your help is much appriciated
@eyaldocs no default way to do that, as response coercion happens in mw chain after handler has returned
you could add a custom mw into the chain before the response-coercion to do that
["/api" {:get {:handler ..., :post-handler (fn [res] ....log the data... res)}]
you could also make the :post-handler
accept a vector of fns and compose those using comp
Is there a way to add field level documentation, like a summary key on the params themselves?