Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateCustomClaims is not re-run when the user claims changes #493

Open
jackcohen5 opened this issue Dec 23, 2021 · 2 comments
Open

validateCustomClaims is not re-run when the user claims changes #493

jackcohen5 opened this issue Dec 23, 2021 · 2 comments
Assignees

Comments

@jackcohen5
Copy link

jackcohen5 commented Dec 23, 2021

Version info

React: 17.0.2

Firebase: 9.6.1

ReactFire: 4.2.1

Other (e.g. Node, browser, operating system) (if applicable):

Test case

const ExamleComponent = () => {
    const { data: { hasRequiredClaims } = {} } =  useSigninCheck({
        validateCustomClaims: (claims) => {
            return {
                hasRequiredClaims: claims.role === 'admin'
            }
        }
    })
     
    return <div>{hasRequiredClaims}</div>
}

Steps to reproduce

Add the above call to a React component and login a user with custom claims that match the condition. Trigger a re-render on the above component.

Expected behavior

Value of hasRequiredClaims changes after user is logged in to accurately reflect condition.

Actual behavior

Value of hasRequiredClaims does not change even after the component is re-rendered.

@tsdexter
Copy link

tsdexter commented May 1, 2022

I think this may be related to a bug I just filed where validateCustomClaims is only called once in the component tree and subsequent calls return the same result #514

@capybarahero
Copy link

capybarahero commented Aug 11, 2023

Hi @jhuleatt,
Sorry for tagging you directly - I saw you assigned this task to yourself a few months ago.

Would you have any updates on this issue?
Thanks a lot! 🙇🏻‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants