Skip to content

cache.get() not working with fallback #4175

@Gregoirevda

Description

@Gregoirevda

Bug report

With <SWRConfig fallback={{'/foo': 'bar'}} >
and useSWR('/foo') I can persist the cache with persist(cache.get('/foo'))
but if no single fetch is made eg useSWRImmutable('/foo') as '/foo' is provided in fallback, cache.get('/foo') returns null.

Expected Behavior

fallback should be set in cache, so it can be retrieved by cache.get() no matter if a revalidation occurred or not

Additional Context

SWR version: 2.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions