修复app 渲染器页面 schemaApi 用法会存在 api 请求混乱问题

This commit is contained in:
liaoxuezhi 2021-04-16 15:35:43 +08:00
parent 503eb4cfa7
commit c559cc1b82
2 changed files with 4 additions and 1 deletions

View File

@ -386,7 +386,7 @@ export default class App extends React.Component<AppProps, object> {
) : null}
{render('page', store.schema, {
key: store.activePage?.id,
key: `${store.activePage?.id}-${store.schemaKey}`,
data: store.pageData
})}
</>

View File

@ -162,7 +162,9 @@ export const AppStore = ServiceStore.named('AppStore')
if (page.schema) {
self.schema = page.schema;
self.schemaKey = '' + Date.now();
} else if (page.schemaApi) {
self.schema = null;
self.fetchSchema(page.schemaApi, self.activePage);
} else if (page.redirect) {
env.jumpTo(page.redirect);
@ -171,6 +173,7 @@ export const AppStore = ServiceStore.named('AppStore')
this.rewrite(page.rewrite, env);
} else {
self.schema = null;
self.schemaKey = '';
}
},