Can I set value of `fetchTime` manually?
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
## Background
### Purpose of `fetchTime`
`fetchTime` was found here.
https://github.com/facebook/relay/blob/6a1127f3b42c630f86886d6b72ec5f6974cdae15/packages/relay-runtime/store/RelayModernStore.js#L95-L103
The`fetchTime` property is used for checking a query response is stale or fresh, right?
### The needs of updating `fetchTime`
A hydration.
[Here](https://stackoverflow.com/questions/72379992/how-to-prepare-and-hydrate-relay-state) is example.
This example shows that how to hydrate a state in a store layer.
A point is that only `_store` is hydrated and `_roots` is not hydrated.
In other words, `fetchTime` was not contained in the hydrated state.
### Workarounds
To solve this, I tried this workaround.
```js
// Dehydration
window.RELAY_ROOTS_MAP = map_to_json(relay.getStore()._roots)
// Hydration
relay.getStore()._roots = json_to_map(window.RELAY_ROOTS_MAP)
```
It works, but the `_roots` seems to be an internal property.
I think it's not the best way.
## Question
- How can I update `_roots` or `fetchTime` manually in a formal way?
- Will you give a method accessing to `_roots` in a future version?
Contributor guide
Assessment
This issue has not been assessed yet.