umijs / plugins

🍣 The one-stop shop for official Umi plugins and presets.
351 stars 237 forks source link

access插件无法读取initialstate的值 #887

Closed wanglianjie91 closed 2 years ago

wanglianjie91 commented 2 years ago

"@umijs/max": "^4.0.2"

access.ts

// permission1 是动态获取的

export default function access(initialState: { permissions?: string[] }) {
  const { permissions } = initialState || {};
  console.log(permissions); // 能打印最新值
  return {
    canVisite: (foo: any) => {
      console.log(permissions); //只有初始值
      return permissions?.includes(foo.key);
    },
  };
}
wanglianjie91 commented 2 years ago

清缓存, 升级到4.0.8。 解决了。