Skip to content

Commit

Permalink
Update resolvers.mdx
Browse files Browse the repository at this point in the history
Remove bad example on prioritization
  • Loading branch information
wilkerlucio committed Apr 30, 2024
1 parent 77d32ec commit f3f07ad
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions docs/resolvers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -902,43 +902,6 @@ You can see that the cached resolver returns `::pco/unknown-value`. This is equi
that key in the response. Doing this way, we can leverage the output inference while expressing this value is unknown, which triggers the next option.
:::

It's important to notice that Pathom will choose will depend on the highest priority
resolver on that path. This means a dependency with a high priority may override the
priority of an "end resolver".

Here is an example of this scenario:

```clojure
(p.eql/process
(pci/register
[(pco/resolver 'high-priority-dep
{::pco/priority 5 ; very high priority
::pco/output [:dep]}
(fn [_ _] {:dep "value"}))

(pco/resolver 'a1
{::pco/priority 1
::pco/input [:dep]
::pco/output [:a]}
(fn [_ _]
{:a 1}))

; this is higher on priority than a1, and has no deps
(pco/resolver 'a2
{::pco/priority 2
::pco/output [:a]}
(fn [_ _]
{:a 2}))])
[:a])
; => {:a 1} ; the lower priority for `:a` won, because the `:dep` on that path had the highest priority
```

Here is the graph to help visualize it:

<div className="pathom-plan-view">
<PlanGraphFileWithDetails path="/viz/resolvers/priority-dep.edn"/>
</div>

### Custom priority algorithm

If you need fine control over prioritization, you can set the key `::pcr/choose-path`
Expand Down

0 comments on commit f3f07ad

Please sign in to comment.