MCPcopy Create free account
hub / github.com/Effect-TS/effect / hydrate

Function hydrate

packages/effect/src/ui/Query.ts:7095–7117  ·  view source on GitHub ↗
(input, hydrateOptions)

Source from the content-addressed store, hash-verified

7093 }
7094 }
7095 const hydrate: CacheInternals["hydrate"] = (input, hydrateOptions) => {
7096 if (disposed) return
7097 const parsed = parseRaw(input)
7098 if (parsed === undefined) {
7099 report(
7100 new HydrationMalformed({
7101 message: "[Query] the ~query state isn't the tuple shape. It was ignored."
7102 })
7103 )
7104 return
7105 }
7106 hydratedAt = hydrateOptions?.at ?? now()
7107 hydratedStatic = hydrateOptions?.static === true
7108 hydrateDecode = hydrateOptions?.decodeSuccess
7109 windowOpen = !hydratedStatic
7110 adopting = true
7111 raw = parsed
7112 // Reads the cache has already seen decode at once.
7113 for (const name of Array.from(raw.keys())) {
7114 const def = queries.get(name)
7115 if (def !== undefined) decodeRaw(def)
7116 }
7117 }
7118 const closeWindow = (): void => {
7119 adopting = false
7120 // An entry made while the page was adopted gets its saved value now: as its

Callers 3

SlotStatus.test.tsFile · 0.50

Calls 7

parseRawFunction · 0.85
decodeRawFunction · 0.85
fromMethod · 0.80
keysMethod · 0.80
reportFunction · 0.70
nowFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected