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

Function writeSnapshot

packages/effect/src/ui/Router.ts:2183–2198  ·  view source on GitHub ↗
(url: string, entry: EntryState)

Source from the content-addressed store, hash-verified

2181 )
2182 /** Writes the entry being left with its snapshot, so it survives a reload. A throw keeps the index only. */
2183 const writeSnapshot = (url: string, entry: EntryState) => {
2184 // The current URL with the entry's snapshot: it supersedes a queued replace.
2185 queued = undefined
2186 try {
2187 history.replace(url, writeState(entry))
2188 } catch (error) {
2189 replaceNow(url, writeState({ index: entry.index }))
2190 report(
2191 new SnapshotWriteFailed({
2192 error,
2193 message:
2194 "[effect/ui] the Router couldn't write the saved state into history.state. It is kept in memory only, so a reload starts the entry fresh."
2195 })
2196 )
2197 }
2198 }
2199 // The mounted `Router.prefetch` declarations.
2200 const declarers = new Set<services.Declarer>()
2201 /** Calls `f` with every declaration covering the location's route, and the route in its union. */

Callers 1

goFunction · 0.85

Calls 4

writeStateFunction · 0.85
replaceNowFunction · 0.85
reportFunction · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected