mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
Changes: 1. Refactored react polling logic, now each `.eval()` call is wrapped in Promise, so we can chain them properly. 2. When user has browser DevTools opened and React DevTools panels were mounted, user might navigate to the page, which doesn't have React running. Previously, we would show just blank white page, now we will show disclaimer. Disclaimer appears after 5 failed attempts to find React. We will also show this disclaimer if it takes too long to load the page, but once any React instance is loaded and registered, we will update the panels. 3. Dark theme support for this disclaimer and popups in Firefox & Chromium-based browsers **Important**: this is only valid for case when React DevTools panels were already created, like when user started debugging React app and then switched to non-React page. If user starts to debug non-React app (by opening browser DevTools for it), we will not create these panels, just like before. Q: "Why do we poll to get information about react?" A: To handle case when react is loaded after the page has been loaded, some sandboxes for example. | Before | After | | --- | --- | | <img width="1840" alt="Screenshot 2023-09-14 at 15 37 37" src="https://github.com/facebook/react/assets/28902667/2e6ffb39-5698-461d-bfd6-be2defb41aad"> | <img width="1840" alt="Screenshot 2023-09-14 at 15 26 16" src="https://github.com/facebook/react/assets/28902667/1c8ad2b7-0955-41c5-b8cc-d0fdb03e13ca"> |
66 lines
1.6 KiB
HTML
66 lines
1.6 KiB
HTML
<!doctype html>
|
|
<html style="display: flex">
|
|
<head>
|
|
<meta charset="utf8">
|
|
<style>
|
|
html {
|
|
display: flex;
|
|
}
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
flex: 1;
|
|
display: flex;
|
|
}
|
|
#container {
|
|
display: flex;
|
|
flex: 1;
|
|
width: 100%;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
}
|
|
.no-react-disclaimer {
|
|
margin: 16px;
|
|
font-family: Courier, monospace, serif;
|
|
font-size: 16px;
|
|
animation: fadeIn .5s ease-in-out forwards;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
0% {
|
|
opacity: 0;
|
|
}
|
|
100% {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
:root {
|
|
color-scheme: dark;
|
|
}
|
|
|
|
@supports (-moz-appearance:none) {
|
|
:root {
|
|
background: black;
|
|
}
|
|
|
|
body {
|
|
color: white;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- main react mount point -->
|
|
<div id="container">
|
|
<h1 class="no-react-disclaimer">Looks like this page doesn't have React, or it hasn't been loaded yet.</h1>
|
|
</div>
|
|
<script src="./build/panel.js"></script>
|
|
</body>
|
|
</html>
|