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: set openWhenHidden to be true #1573

Merged
merged 1 commit into from
May 17, 2023

Conversation

yanCode
Copy link
Contributor

@yanCode yanCode commented May 17, 2023

deep in the source code of fetch-event-source , (not the readme markdown document). you can find something here:

    /**
     * If true, will keep the request open even if the document is hidden.
     * By default, fetchEventSource will close the request and reopen it
     * automatically when the document becomes visible again.
     */
    openWhenHidden?: boolean;

this is much like TanStack Query or SWR
which stops http fetching while the browser tab is hidden (shift to be inactive, to back). and restart to fetch data when current tab is shifted back. I personally believe this is a great feature for most scenarios fetching short responses to do cache and revalidate cache. but not the case for a long streaming response.. so the solution to it is to set openWhenHidden: true, this makes it continue loading long contents without interruptions even if current tab is shifted back and forth.

This PR fixes the bug reported in #1566

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

Great work, this really saves my life 😆

@Yidadaa Yidadaa merged commit db29fed into ChatGPTNextWeb:main May 17, 2023
@yanCode yanCode deleted the fix/tab-change branch May 17, 2023 12:49
xuzhenjun130 pushed a commit to xuzhenjun130/ChatGPT-Next-Web that referenced this pull request May 31, 2023
gaogao1030 pushed a commit to gaogao1030/ChatGPT-Next-Web that referenced this pull request May 16, 2024
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.

2 participants