Skip to content

Commit b334537

Browse files
authored
Merge pull request #326 from FlowiseAI/bugfix/Auto-Create-Full-Page-If-Missing
Bugfix/flowise-fullchatbot initialization if missing
2 parents b117c69 + c3250b2 commit b334537

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

dist/web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/window.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/window.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ let elementUsed: Element | undefined;
1515

1616
export const initFull = (props: BotProps & { id?: string }) => {
1717
destroy();
18-
const fullElement = props.id ? document.getElementById(props.id) : document.querySelector('flowise-fullchatbot');
19-
if (!fullElement) throw new Error('<flowise-fullchatbot> element not found.');
20-
Object.assign(fullElement, props);
18+
let fullElement = props.id ? document.getElementById(props.id) : document.querySelector('flowise-fullchatbot');
19+
if (!fullElement) {
20+
fullElement = document.createElement('flowise-fullchatbot');
21+
Object.assign(fullElement, props);
22+
document.body.appendChild(fullElement);
23+
} else {
24+
Object.assign(fullElement, props);
25+
}
2126
elementUsed = fullElement;
2227
};
2328

0 commit comments

Comments
 (0)