Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chat-panel): react rendering #2236

Merged
merged 5 commits into from
May 28, 2024
Merged

fix(chat-panel): react rendering #2236

merged 5 commits into from
May 28, 2024

Conversation

wwayne
Copy link
Contributor

@wwayne wwayne commented May 24, 2024

I tried another way - destroying previous instance and create a new one

function useServer(api: ServerApi) {
  const [server, setServer] = useState<ClientApi | null>(null)
  let abortController:AbortController

  useEffect(() => {
    const isInIframe = window.self !== window.top
    if (isInIframe) {
      abortController?.abort()
      abortController = new AbortController()
      setServer(createServer(api, abortController.signal))
    }
  }, [])

  return server
}

But in this way, the thread lib will throw error, so I keep using isCreated for simplify

1 111

@wwayne wwayne requested a review from wsxiaoys May 24, 2024 11:05
@wsxiaoys wsxiaoys requested review from liangfung and removed request for wsxiaoys May 24, 2024 11:06
@wwayne wwayne marked this pull request as draft May 27, 2024 08:19
@wwayne wwayne marked this pull request as ready for review May 28, 2024 08:50
@wwayne wwayne merged commit c654270 into main May 28, 2024
4 checks passed
@wwayne wwayne deleted the chat-panel branch May 28, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant