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

preact build hanging after seemingly successful build when using react-query #1554

Open
1 task
kapnoc opened this issue May 7, 2021 · 0 comments
Open
1 task

Comments

@kapnoc
Copy link

kapnoc commented May 7, 2021

  • Check if updating to the latest Preact version resolves the issue

Describe the bug
When using react-query's useQuery, building with prerender (default) makes preact build hang indefinitely, after a seemingly successful build (no error message, and normal looking list of created files):

 Build  [======] 95% (1.6s) emitting
                 bundle.7e56a.css ⏤  445 B
              bundle.*****.esm.js ⏤  20.8 kB
           polyfills.*****.esm.js ⏤  2.18 kB
       route-home.chunk.e6c71.css ⏤  74 B
    route-home.chunk.*****.esm.js ⏤  288 B
    route-profile.chunk.62c75.css ⏤  77 B
 route-profile.chunk.*****.esm.js ⏤  469 B
        route-home.chunk.723ad.js ⏤  291 B
                       index.html ⏤  1.24 kB
                         200.html ⏤  829 B
               polyfills.3cf93.js ⏤  2.17 kB
     route-profile.chunk.8b71c.js ⏤  486 B
                  bundle.73fb3.js ⏤  20.8 kB

This doesn't hang, and does exit normally when using preact build --no-prerender
There is also no problems running this with preact watch

To Reproduce

Steps to reproduce the behavior:

  1. Create default app with preact create
  2. Add react-query dep, in my case: "react-query": "^3.15.2"
  3. Change src/components/app.js to :
import { h } from 'preact';
import { Router } from 'preact-router';
import { QueryClient, QueryClientProvider, useQuery } from 'react-query'

import Header from './header';

// Code-splitting is automated for `routes` directory
import Home from '../routes/home';
import Profile from '../routes/profile';

export const queryClient = new QueryClient()

const TestElement = () => {
	const { data, isLoading } = useQuery('test', () => 'test1')
	if (isLoading) {
		return (<span>Loading...</span>)
	}

	return (<span>{data}</span>)
}

const App = () => (
	<div id="app">
		<QueryClientProvider client={queryClient}>
			<Header />
			<TestElement />
			<Router>
				<Home path="/" />
				<Profile path="/profile/" user="me" />
				<Profile path="/profile/:user" />
			</Router>
		</QueryClientProvider>
	</div>
)

export default App;
  1. Run preact build

Expected behavior
I would expect the build to exit after the files are built. In that test case, useQuery should receive instantly resolving test data, so I don't see the hang coming from "trying to get data to render".

This could of course be expected behaviour that I am not aware of, which I guess could be documented somewhere.

@kapnoc kapnoc changed the title preact build hanging after successful build when using react-query preact build hanging after seemingly successful build when using react-query May 7, 2021
@marvinhagemeister marvinhagemeister transferred this issue from preactjs/preact May 7, 2021
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

No branches or pull requests

1 participant