Skip to content

Commit be44a58

Browse files
committed
fix(core): Repair application hardpoints cache has been exist for old mount point
1 parent dd10c3a commit be44a58

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- run: npx conventional-github-releaser -p angular
16+
env:
17+
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"reset": "lerna clean --yes && rm -rf node_modules",
2929
"setup": "yarn reset && yarn install --registry=https://registry.npmjs.org",
3030
"prepublishOnly": "yarn test && yarn build:all",
31-
"postpublish": "yarn changelog && node scripts/asyncBnpm.js",
32-
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -p ",
31+
"postpublish": "node scripts/asyncBnpm.js",
3332
"test": "node scripts/jestTest.js",
3433
"test:cover": "node scripts/jestTest.js --coverage",
3534
"ls-lint": "ls-lint",
@@ -86,7 +85,6 @@
8685
"babel-polyfill": "^6.26.0",
8786
"chalk": "^4.1.0",
8887
"codecov": "^3.8.1",
89-
"conventional-changelog-cli": "^2.1.1",
9088
"cross-env": "^7.0.3",
9189
"cypress": "^8.0.0",
9290
"dir-parser": "^1.2.10",

packages/runtime/core/src/garfish.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,6 @@ export class Garfish extends EventEmitter implements interfaces.Garfish {
227227
};
228228
}
229229

230-
// Initialize the mount point, support domGetter as promise, is advantageous for the compatibility
231-
if (appInfo.domGetter) {
232-
if (
233-
typeof appInfo.domGetter === 'function' &&
234-
isPromise(appInfo.domGetter)
235-
) {
236-
appInfo.domGetter = await appInfo.domGetter();
237-
}
238-
const originDomGetter = appInfo.domGetter;
239-
Object.defineProperty(appInfo, 'domGetter', {
240-
get: () => getRenderNode(originDomGetter),
241-
});
242-
}
243-
244230
const asyncLoadProcess = async () => {
245231
// Return not undefined type data directly to end loading
246232
const stopLoad = await this.hooks.lifecycle.beforeLoad.call(appInfo);

packages/runtime/core/src/module/app.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
parseContentType,
1717
createAppContainer,
1818
setDocCurrentScript,
19+
getRenderNode,
1920
} from '@garfish/utils';
2021
import { Garfish } from '../garfish';
2122
import { interfaces } from '../interface';
@@ -184,7 +185,7 @@ export class App {
184185
revertCurrentScript();
185186
}
186187

187-
show() {
188+
async show() {
188189
this.active = true;
189190
const { display, mounted, provider } = this;
190191
if (display) return false;
@@ -193,7 +194,7 @@ export class App {
193194
return false;
194195
}
195196

196-
this.addContainer();
197+
await this.addContainer();
197198
this.callRender(provider, false);
198199
this.display = true;
199200
this.context.activeApps.push(this);
@@ -294,10 +295,10 @@ export class App {
294295
}
295296

296297
// Performs js resources provided by the module, finally get the content of the export
297-
compileAndRenderContainer() {
298+
async compileAndRenderContainer() {
298299
// Render the application node
299300
// If you don't want to use the CJS export, at the entrance is not can not pass the module, the require
300-
this.renderTemplate();
301+
await this.renderTemplate();
301302

302303
// Execute asynchronous script
303304
return new Promise<void>((resolve) => {
@@ -393,13 +394,16 @@ export class App {
393394

394395
// Create a container node and add in the document flow
395396
// domGetter Have been dealing with
396-
private addContainer() {
397-
if (typeof (this.appInfo.domGetter as Element).appendChild === 'function') {
398-
(this.appInfo.domGetter as Element).appendChild(this.appContainer);
397+
private async addContainer() {
398+
// Initialize the mount point, support domGetter as promise, is advantageous for the compatibility
399+
const domGetter = await getRenderNode(this.appInfo.domGetter);
400+
401+
if (typeof domGetter.appendChild === 'function') {
402+
domGetter.appendChild(this.appContainer);
399403
}
400404
}
401405

402-
private renderTemplate() {
406+
private async renderTemplate() {
403407
const { appInfo, entryManager, resources } = this;
404408
const { url: baseUrl, DOMApis } = entryManager;
405409
const { htmlNode, appContainer } = createAppContainer(appInfo.name);
@@ -409,7 +413,7 @@ export class App {
409413
this.appContainer = appContainer;
410414

411415
// To append to the document flow, recursive again create the contents of the HTML or execute the script
412-
this.addContainer();
416+
await this.addContainer();
413417

414418
const customRenderer: Parameters<typeof entryManager.createElements>[0] = {
415419
meta: () => null,

packages/runtime/utils/src/container.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ export function createAppContainer(name: string) {
1616
};
1717
}
1818

19-
export function getRenderNode(domGetter: interfaces.DomGetter): Element {
19+
export async function getRenderNode(domGetter: interfaces.DomGetter) {
2020
assert(domGetter, `Invalid domGetter:\n ${domGetter}.`);
2121

2222
let appWrapperNode = domGetter;
2323

2424
if (typeof domGetter === 'string') {
2525
appWrapperNode = document.querySelector(domGetter);
2626
} else if (typeof domGetter === 'function') {
27-
appWrapperNode = (domGetter as () => Element)();
27+
appWrapperNode = await (domGetter as () => Element)();
2828
} else if (typeof domGetter === 'object') {
2929
appWrapperNode = domGetter;
3030
}

0 commit comments

Comments
 (0)