Comments (6)
I would like to know why someone would want to set the entry as a function. If it's simply to make the entry dynamic, it can be converted in the beforeRegisterApp hook so that any necessary parameters can be processed. If we implement it internally, we may execute the entry function directly during registerApp and then register the entry as a string. This should be consistent with how the beforeRegisterApp hook handles it, but it may cause confusion because the user doesn't know when the entry will be executed.
from garfish.
I would like to know why someone would want to set the entry as a function. If it's simply to make the entry dynamic, it can be converted in the beforeRegisterApp hook so that any necessary parameters can be processed. If we implement it internally, we may execute the entry function directly during registerApp and then register the entry as a string. This should be consistent with how the beforeRegisterApp hook handles it, but it may cause confusion because the user doesn't know when the entry will be executed.
entry should change when history change, not just registerApp. see above nextjs example
from garfish.
I see, but for this case, I think it can be placed in the beforeLoad hook, as it involves the behavior of location change. Also, we now cache resources, and if it's dynamic, it may involve cache invalidation. I'm wondering if you can customize an additional parameter to dynamically determine whether appInfo can be recalculated. For example:
Garfish.run({
apps: [
{
name: 'vue',
entry: '',
entryFn: ()=> 'xxx',
}
],
beforeLoad(appInfo){
if (appInfo.entryFn) {
appInfo.entry = appInfo.entryFn()
}
}
})
from garfish.
I see, but for this case, I think it can be placed in the beforeLoad hook, as it involves the behavior of location change. Also, we now cache resources, and if it's dynamic, it may involve cache invalidation. I'm wondering if you can customize an additional parameter to dynamically determine whether appInfo can be recalculated. For example:
Garfish.run({ apps: [ { name: 'vue', entry: '', entryFn: ()=> 'xxx', } ], beforeLoad(appInfo){ if (appInfo.entryFn) { appInfo.entry = appInfo.entryFn() } } })
- prerender does not involve cache problem
- still a little hacky: yiminghe/micro-front-end-nextjs@d317749
- entry must be a url, unnecessary fetch:
from garfish.
Sorry, forgot to reply. In response to this problem, I suggest to treat it as a different appInstan, because now each entry is unique, and if the same entry is changed, it is actually equivalent to a different application. We are not very good at handling appInstance. Support does not support dynamic entry, which will cause damage to our cache instance
from garfish.
Sorry, forgot to reply. In response to this problem, I suggest to treat it as a different appInstan, because now each entry is unique, and if the same entry is changed, it is actually equivalent to a different application. We are not very good at handling appInstance. Support does not support dynamic entry, which will cause damage to our cache instance
Current solution using beforeLoad and cache false almost works, dynamic entry is not required
from garfish.
Related Issues (20)
- Garfish preload plugin HOT 3
- domGetter为string且dom树下没有对应的节点,会导致无限递归。 HOT 2
- 子应用动态挂载子app时会出现destroy 不是一个function HOT 30
- RegisterMicroApps.jsx:102 TypeError: Cannot read properties of undefined (reading 'call') HOT 2
- app.show 是否支持传参,更新 props HOT 3
- registerApp 设置 basename 之后用于 activeWhen 判断的 path 处理方式是否有问题 HOT 3
- 中文文档意义不明 HOT 1
- Svelte(kit) bridge support ?
- 将vite子应用正常打包后在应用渲染异常,开发环境时一切正常
- @garfish/es-module returns "does not provide an export named..." while analyse module with `export * from ...` HOT 2
- TypeScript: Could not find a declaration file for module "garfish" HOT 4
- 官网文档不友好 HOT 2
- 支持 ssr 的子应用接入吗,如next.js HOT 2
- 微应用之间跨域cookie携带问题 HOT 1
- TemplateManager.findAttributeValue对值为空的HTML布尔属性处理错误 HOT 1
- 支持带基座启动 vite + React 子应用吗? HOT 10
- @garfish/css-scope 中的 super-fast-md5 依赖,在 vite 环境下会报错 HOT 1
- TypeError: Cannot read properties of undefined (reading '__GARFISH_EXPORTS__') HOT 9
- 子应用引入Leaflet时garfish会报错
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from garfish.