-
-
Notifications
You must be signed in to change notification settings - Fork 383
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: safari does not paint the fallback component #506
Conversation
8700e54
to
f0d17f0
Compare
Sorry the code is not correct, could you please add an issue instead to describe your problem. |
Any ideas why your code fixes the problem? Single |
@theKashey The intention is to put the requests of async chunks to other event loop phase, let safari paints the dom of the fallback component first. It seems safari tries to do some optimizations by delaying the painting of dom if it is requesting some async chunks. But I did not really examine the source code of webkit. I expected one |
I've played with your example a bit, removed all possible side effects like Strangely why you were the first one who discovered this bug. Wrapping initial load with So - to resolve the problem it is enough to delay Plus - such logic would make
|
It's also enough to call It's also as well enough to change Let's first find a bug in webkit bug tracker. |
Ok. I am closing this PR. Yes - you will see "Loading", not NO, just after it a __whole application would be frozen until css file is loaded". I make a simple example, based of your code: const Home = lazy(() => new Promise(resolve => setTimeout(() => resolve(import('./Home')), 1000)));
// ^^ delay import my 1s to let "loading" be displayed
const App = () => {
const [state, setState] = useState(0);
useEffect(
() => {
setInterval(() => setState(s => s + 1), 100);
},
[]
);
return <div>
<React.Suspense fallback={<Loading/>}><Home/></React.Suspense>
{state}
here is a counter, changing 10 times per second...
</div>
}
export default App; Long story short - counted would not count. This problem should be solved elsewhere. |
@theKashey Totally agree. I should have just opened an issue instead of an pr with terrible code. |
@hkhere - you did everything right. You raised the issue, then raised attention to the problem, you led to the underlying problem discovery, and, as a result, you will get your issue fixed. |
While a async chunk is being loaded, safari will not paint the fallback component's dom untill the async chunk is completely loaded.