Skip to content

Conversation

@dodo920306
Copy link
Contributor

Since SecurityLayout will fetch the current user, there is no need to fetch the current user again in BasicLayout. As presented in src/dashboard/config/router.config.js:

...
  {
    path: '/',
    component: '../layouts/SecurityLayout',
    routes: [
      {
        path: '/',
        component: '../layouts/BasicLayout',
        authority: ['admin', 'member'],
        routes: [
...

SecurityLayout will always be accessed first before BasicLayout, and we have fetchCurrent in SecurityLayout:

...
  componentDidMount() {
    this.setState({
      isReady: true,
    });
    const { dispatch } = this.props;

    if (dispatch) {
      dispatch({
        type: 'user/fetchCurrent',
      });
    }
  }
...

.

dodo920306 and others added 2 commits July 15, 2025 12:47
Since `SecurityLayout` will fetch the current user, there is no need to
fetch the current user again in `BasicLayout`.

Signed-off-by: dodo920306 <[email protected]>
@yeasy yeasy merged commit fe3b0b3 into hyperledger-cello:main Jul 16, 2025
3 checks passed
@dodo920306 dodo920306 deleted the fix/fetch-user-twice-for-the-layouts branch July 19, 2025 00:36
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

Successfully merging this pull request may close these issues.

2 participants