This is an automated email from the ASF dual-hosted git repository.
tbonelee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 026dafdea5 [ZEPPELIN-6447] Add Module Federation typing for the
published paragr…
026dafdea5 is described below
commit 026dafdea5ed82c2616a8ed792f57c86feddd0f3
Author: JangAyeon <[email protected]>
AuthorDate: Tue Jul 28 00:33:24 2026 +0900
[ZEPPELIN-6447] Add Module Federation typing for the published paragr…
### What is this PR for?
`PublishedParagraphComponent.loadReactWidget()` read the global Module
Federation container via `window.reactApp` behind a `<at>ts-ignore` comment, so
the compiler couldn't check the `container.get(...)` call that follows it.
`ReactRemoteLoaderService` already declares this container's shape as
`RemoteContainer` and augments `Window.reactApp` with it globally. This PR
exports that existing interface and reuses it here instead of adding a second,
possibly conflicting `Window.reactApp` typing.
### What type of PR is it?
Improvement
### Todos
* [x] Remove the `<at>ts-ignore` comment near `window.reactApp`
* [x] Type the container with the existing `RemoteContainer` interface
(covers the `get` API used here)
* [x] Preserve the `window.reactApp not available` error when the
container is missing
### What is the Jira issue?
[ZEPPELIN-6447](https://issues.apache.org/jira/browse/ZEPPELIN-6447)
### How should this be tested?
* `cd zeppelin-web-angular && npm run lint` passes with no new errors.
* Load a published paragraph with `?react=true` and confirm the React
widget still mounts; without the remote entry script, the "window.reactApp not
available" error still surfaces.
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Closes #5343 from JangAyeon/ZEPPELIN-6447.
Signed-off-by: ChanHo Lee <[email protected]>
---
.../app/pages/workspace/published/paragraph/paragraph.component.ts | 4 ++--
.../src/app/share/react-mount/react-remote-loader.service.ts | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git
a/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts
b/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts
index 8429e895e2..b1b05d44a7 100644
---
a/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts
+++
b/zeppelin-web-angular/src/app/pages/workspace/published/paragraph/paragraph.component.ts
@@ -30,6 +30,7 @@ import {
ParagraphIResultsMsgItem
} from '@zeppelin/sdk';
import { HeliumService, MessageService, NgZService, NoteStatusService } from
'@zeppelin/services';
+import { RemoteContainer } from '@zeppelin/share';
import { SpellResult } from '@zeppelin/spell';
import { isNil } from 'lodash';
import { NzModalService } from 'ng-zorro-antd/modal';
@@ -222,8 +223,7 @@ export class PublishedParagraphComponent extends
ParagraphBase implements Publis
}
const loadModule = async () => {
- // @ts-ignore
- const container = window.reactApp;
+ const container: RemoteContainer | undefined = window.reactApp;
if (!container) {
throw new Error('window.reactApp not available');
}
diff --git
a/zeppelin-web-angular/src/app/share/react-mount/react-remote-loader.service.ts
b/zeppelin-web-angular/src/app/share/react-mount/react-remote-loader.service.ts
index 75e8a2fd4d..c3f45911ea 100644
---
a/zeppelin-web-angular/src/app/share/react-mount/react-remote-loader.service.ts
+++
b/zeppelin-web-angular/src/app/share/react-mount/react-remote-loader.service.ts
@@ -14,7 +14,7 @@ import { Injectable } from '@angular/core';
import { environment } from '../../../environments/environment';
import { AnyExposedModule } from './react-mount-handle';
-interface RemoteContainer {
+export interface RemoteContainer {
get<T>(key: string): Promise<() => T>;
init?: (shareScope: unknown) => Promise<void>;
}