mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
MISC: Fix bugs in useRerender hook and ns.moveTail (#1263)
This commit is contained in:
parent
19984a6f22
commit
8ebfcdb089
@ -58,6 +58,7 @@ export class LogBoxProperties {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.updateDOM();
|
||||
this.rerender();
|
||||
}
|
||||
|
||||
setSize(width: number, height: number): void {
|
||||
|
@ -4,9 +4,9 @@ import { useCallback, useEffect, useState } from "react";
|
||||
* @param autoRerenderTime: Optional. If provided and nonzero, used as the ms interval to automatically call the rerender function.
|
||||
*/
|
||||
export function useRerender(autoRerenderTime?: number) {
|
||||
const [__, setRerender] = useState(false);
|
||||
const [__, setRerender] = useState(0);
|
||||
|
||||
const rerender = useCallback(() => setRerender((old) => !old), []);
|
||||
const rerender = useCallback(() => setRerender((currentValue) => currentValue + 1), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!autoRerenderTime) return;
|
||||
|
Loading…
Reference in New Issue
Block a user