mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
25 lines
502 B
TypeScript
25 lines
502 B
TypeScript
import React from "react";
|
|
import {
|
|
DevToolsContext,
|
|
DevtoolsEvent,
|
|
receive,
|
|
} from "@refinedev/devtools-shared";
|
|
|
|
export const ReloadOnChanges = () => {
|
|
const { ws } = React.useContext(DevToolsContext);
|
|
|
|
React.useEffect(() => {
|
|
if (ws) {
|
|
const unsubscribe = receive(ws, DevtoolsEvent.RELOAD, () => {
|
|
window.location.reload();
|
|
});
|
|
|
|
return unsubscribe;
|
|
}
|
|
|
|
return () => 0;
|
|
}, [ws]);
|
|
|
|
return null;
|
|
};
|