Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3359427
D11114.id37778.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
807 B
Referenced Files
None
Subscribers
None
D11114.id37778.diff
View Options
diff --git a/web/web-lock.js b/web/web-lock.js
--- a/web/web-lock.js
+++ b/web/web-lock.js
@@ -94,6 +94,17 @@
return lockStatuses.ACQUIRED;
}, [lockRequest, isVisible]);
+ React.useEffect(() => {
+ if (!import.meta.webpackHot) {
+ return undefined;
+ }
+ const webpackHot: WebpackHot = (import.meta.webpackHot: any);
+ webpackHot.dispose(releaseLockOrAbortRequest);
+ return () => {
+ webpackHot.removeDisposeHandler(releaseLockOrAbortRequest);
+ };
+ }, [releaseLockOrAbortRequest]);
+
return { lockStatus, releaseLockOrAbortRequest };
}
@@ -127,4 +138,9 @@
type LockMode = 'exclusive' | 'shared';
+type WebpackHot = {
+ +dispose: ((data: mixed) => void) => void,
+ +removeDisposeHandler: ((data: mixed) => void) => void,
+};
+
export { useWebLock };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 9:01 AM (19 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578873
Default Alt Text
D11114.id37778.diff (807 B)
Attached To
Mode
D11114: [web] Release lock on app hot reload
Attached
Detach File
Event Timeline
Log In to Comment