Skip to content

Continuous rerendering of components using frontend/src/wrapper/* #3403

@ManaswibRane

Description

@ManaswibRane

What happened

Continuous rerendering of components using the frontend/src/wrapper files(almost all)
We compare arrays which can never be true( []!=[])
Image

The code targeted:
const [isAuthenticated, fetchUserAccess] = useAuthStore(
React.useCallback(
(state) => [state.isAuthenticated(), state.service.fetchUserAccess],
[],
),

to
const isAuthenticated = useAuthStore(
React.useCallback((state) => state.isAuthenticated, []),
);
const fetchUserAccess = useAuthStore(
React.useCallback((state) => state.service.fetchUserAccess, []),
);

needs to be changed similarly in frontend/src/wrappers/Authguard.jsx , frontend/src/wrappers/withAuth.jsx and frontend/src/wrappers/IfAuthRedirected.jsx

Environment

  1. OS:All
  2. IntelOwl version: latest

What did you expect to happen

Should rerender only when logout or smtg like that

How to reproduce your issue

kept a console.count to demonstrate

Error messages and logs

Before:

Image After: Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions