Skip to content

Barrier: Add a way to check if it's active asynchronously #457

@optislav

Description

@optislav

In the docs, we have this example:

import { createBarrier } from '@farfetched/core';

const $authToken = createStore(/* ... */);

const authBarrier = createBarrier({
  active: combine($authToken, (token) => isTokenInvalid(token)),
});

However, there is no way to check if the token is valid synchronously in Firebase, as getIdToken() always returns a promise.
https://firebase.google.com/docs/reference/js/v8/firebase.User#getidtoken

Maybe active should also accept an effect that returns a boolean?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions