with one click
react-class-to-functional
Convert React class components to functional components with hooks
Menu
Convert React class components to functional components with hooks
Run a single CockroachDB roachtest end-to-end: pick local vs. user's GCE worker, launch detached on worker via tmux + `roachstress.sh` with long-poll done-notification and tail. Use whenever user asks to run/stress/kick off a roachtest, or just modified one and next step is running it. Single test + single iteration only; nightly loops belong elsewhere.
Analyze DRT cluster health for a given time range. Reconstructs the operations timeline, checks CockroachDB metrics (availability, latency, storage, changefeeds, jobs, goroutines, admission control, LSM, KV prober) and logs for anomalies, correlates findings with disruptive operations to distinguish expected side-effects from real bugs. Use when asked to "analyze DRT", "check cluster health", "what happened on the DRT cluster", "DRT health report", investigate DRT issues, or review DRT operations. Also use when the user mentions a DRT cluster name (drt-scale, drt-chaos, drt-large, etc.) in the context of health or operations.
Skip a flaky or broken test with proper issue tracking. Use when asked to skip a test, disable a test, or mark a test as flaky.
Use when downloading test logs, artifacts, or outputs.zip from EngFlow build invocations. Use when investigating CockroachDB CI test failures hosted on mesolite.cluster.engflow.com.
Migrate React components from Redux + Saga to SWR hooks. Use when converting data fetching from Redux store (reducers, sagas, selectors, connect HOC) to SWR-based hooks in CockroachDB DB Console or cluster-ui.
Bump cluster-ui package version after a release branch cut. Creates two PRs — one to drop the prerelease suffix on the release branch and one to increment the minor version on master.
| name | react-class-to-functional |
| description | Convert React class components to functional components with hooks |
| argument-hint | <file-path> |
Convert the React class component at $ARGUMENTS to a functional component using React hooks.
this.state = { ... } → individual useState hooksthis.setState({ key: value }) → setter functionthis.setState(prev => ...) → functional update formsetExpandedRows(prev => { const next = new Set(prev); next.add(key); return next; });
| Class | Functional |
|---|---|
componentDidMount | useEffect(fn, []) |
componentDidUpdate | useEffect(fn) or useEffect(fn, [deps]) |
componentWillUnmount | useEffect(() => cleanup, []) |
| mount + unmount | single useEffect with cleanup return |
React.createRef() → useRef(null)static contextType → useContext(MyContext)this.timer) → useRefcreateSelector (reselect) → useMemo with explicit dependency arraythis.props.x → destructured propsstatic defaultProps → default parameter values?) in the interface:
interface Props { sortSetting?: SortSetting; }
function Component({ sortSetting = defaultValue }: Props) { ... }
this.setState(update, callback) has no direct hook equivalent. Use ref + useEffect:
const pendingRef = useRef(false);
const prevRef = useRef(value);
const onUpdate = useCallback(() => {
pendingRef.current = true;
setValue(newValue);
}, []);
useEffect(() => {
if (pendingRef.current && prevRef.current !== value) {
pendingRef.current = false;
doCallback();
}
prevRef.current = value;
}, [value, doCallback]);
class MyTable extends SortedTable<Row> {} → const MyTable = SortedTable<Row>;<SortedTable<Row> {...props} />this. references removeduseCallback is actually called)package.json, run ESLint (fix) and Tests