mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-05 15:16:41 +08:00
fix: repeat rendering (#3)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import './styles.scss'
|
||||
import { unmountComponentAtNode } from 'react-dom'
|
||||
import { render } from 'preact'
|
||||
import DecisionCard from '../components/DecisionCard'
|
||||
import { config as siteConfig } from './site-adapters'
|
||||
@@ -27,13 +28,19 @@ async function mountComponent(siteConfig, userConfig) {
|
||||
)
|
||||
return
|
||||
|
||||
document.querySelectorAll('.chat-gpt-container').forEach((e) => e.remove())
|
||||
document.querySelectorAll('.chat-gpt-container').forEach((e) => {
|
||||
unmountComponentAtNode(e)
|
||||
e.remove()
|
||||
})
|
||||
|
||||
let question
|
||||
if (userConfig.inputQuery) question = await getInput([userConfig.inputQuery])
|
||||
if (!question && siteConfig) question = await getInput(siteConfig.inputQuery)
|
||||
|
||||
document.querySelectorAll('.chat-gpt-container').forEach((e) => e.remove())
|
||||
document.querySelectorAll('.chat-gpt-container').forEach((e) => {
|
||||
unmountComponentAtNode(e)
|
||||
e.remove()
|
||||
})
|
||||
const container = document.createElement('div')
|
||||
container.className = 'chat-gpt-container'
|
||||
render(
|
||||
|
||||
Reference in New Issue
Block a user