Fix reload (#10109)

* Fix reloading data

* Don't show new review data when not looking at last 24 hours

* Fix refresh button and no items text

* Cleanup
This commit is contained in:
Nicolas Mowen
2024-02-28 07:16:32 -07:00
committed by GitHub
parent 8072ce25c6
commit a978adc5a9
3 changed files with 24 additions and 21 deletions

View File

@@ -28,9 +28,10 @@ export default function Events() {
// review paging
const [beforeTs, setBeforeTs] = useState(Date.now() / 1000);
const last24Hours = useMemo(() => {
return { before: Date.now() / 1000, after: getHoursAgo(24) };
}, []);
return { before: beforeTs, after: getHoursAgo(24) };
}, [beforeTs]);
const selectedTimeRange = useMemo(() => {
if (reviewSearchParams["after"] == undefined) {
return last24Hours;
@@ -73,7 +74,7 @@ export default function Events() {
};
return ["review", params];
},
[reviewSearchParams]
[reviewSearchParams, last24Hours]
);
const {
@@ -96,10 +97,7 @@ export default function Events() {
setSize(size + 1);
}, [size]);
const reloadData = useCallback(() => {
setSize(1);
updateSegments();
}, []);
const reloadData = useCallback(() => setBeforeTs(Date.now() / 1000), []);
// preview videos

View File

@@ -97,8 +97,9 @@ function Logs() {
</div>
{!endVisible && (
<div
className="absolute bottom-8 left-[50%] -translate-x-[50%] rounded-xl bg-accent-foreground text-white z-20 p-2"
<Button
className="absolute bottom-8 left-[50%] -translate-x-[50%] rounded-xl bg-accent-foreground text-white bg-gray-400 z-20 p-2"
variant="secondary"
onClick={() =>
contentRef.current?.scrollTo({
top: contentRef.current?.scrollHeight,
@@ -107,7 +108,7 @@ function Logs() {
}
>
Jump to Bottom
</div>
</Button>
)}
<div