|
2086 | 2086 | (-check-children! :ref properties children 1 1) |
2087 | 2087 | (when-not (-reference? ref) |
2088 | 2088 | (-fail! ::invalid-ref {:ref ref})) |
2089 | | - (let [child (delay (or (mr/-schema (-registry options) ref) |
2090 | | - (when-not allow-invalid-refs |
2091 | | - (-fail! ::invalid-ref {:type :ref, :ref ref})))) |
2092 | | - _ (when-not lazy @child) |
2093 | | - rf (-memoize (fn [] (schema @child options))) |
| 2089 | + (let [?schema (delay (or (mr/-schema (-registry options) ref) |
| 2090 | + (when-not allow-invalid-refs |
| 2091 | + (-fail! ::invalid-ref {:type :ref, :ref ref})))) |
| 2092 | + _ (when-not lazy @?schema) |
| 2093 | + rf (-memoize (fn [] (schema @?schema options))) |
2094 | 2094 | children (vec children) |
2095 | 2095 | form (delay (-simple-form parent properties children identity options)) |
2096 | 2096 | cache (-create-cache options) |
|
2106 | 2106 | id (-identify-ref-schema this)] |
2107 | 2107 | (if lazy |
2108 | 2108 | (let [rv (ref-validators id) |
2109 | | - vol (or rv (volatile! nil)) |
2110 | | - reg (when-not rv (-registry options))] |
| 2109 | + vol (or rv (volatile! nil))] |
2111 | 2110 | (fn [x] |
2112 | 2111 | (if-let [f @vol] |
2113 | 2112 | (f x) |
2114 | | - (let [s @child |
2115 | | - f (binding [*ref-validators* (assoc ref-validators id vol)] |
2116 | | - (-validator s))] |
| 2113 | + (let [f (binding [*ref-validators* (assoc ref-validators id vol)] |
| 2114 | + (-validator (schema @?schema options)))] |
2117 | 2115 | (vreset! vol f) |
2118 | 2116 | (f x))))) |
2119 | 2117 | (if-some [vol (ref-validators id)] |
2120 | 2118 | #(@vol %) |
2121 | 2119 | (let [vol (volatile! nil) |
2122 | | - s (if-let [s @child] |
2123 | | - (schema s options) |
2124 | | - (-fail! ::invalid-ref {:type :ref, :ref ref})) |
2125 | 2120 | f (binding [*ref-validators* (assoc ref-validators id vol)] |
2126 | | - (-validator s))] |
| 2121 | + (-validator (schema @?schema options)))] |
2127 | 2122 | (vreset! vol f) |
2128 | 2123 | f))))) |
2129 | 2124 | (-explainer [_ path] |
|
0 commit comments