quiet-monkey-7986
05/22/2023, 11:47 AMfuture-teacher-7046
quiet-monkey-7986
05/22/2023, 12:28 PMlocalStorage
to sessionStorage
(Or any contract) on setPolyfills
, it doesn't utilize the cache. It saves correctly, but it doesn't utilize it.
Ex:
const cache = new Map();
setPolyfills({
localStorage: {
getItem: (key) => cache.get(key),
setItem: (key, value) => cache.set(key, value)
}
});
future-teacher-7046
quiet-monkey-7986
05/22/2023, 1:22 PMBasically, localStorage is only used to restore initial state across page views. After that, a fast in-memory cache is used instead (editado)Thank you for the answer, but the problem is with that initial state, using whatever polyfill but localStorage, it doesn't use it for initialState. Instead, it requests again to the API on every refresh. With the localStorage config, it takes on the initial state until the staleTTL expires; after it the problem I've told you before occurs, it doesn't update the localStorage and never uses it again for new initial states.
future-teacher-7046
GrowthBook
instance.
As for the staleTTL issue, I was able to reproduce the bug. I'll work on a fix today.quiet-monkey-7986
05/22/2023, 1:37 PMWhen are you setting the polyfill? It must be set before creating the firstThat was the problem, thank you.instance.GrowthBook
As for the staleTTL issue, I was able to reproduce the bug. I'll work on a fix today.Thank you so much.