-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix messages not refreshing * Explicitly filter null and undefined values to avoid filtering valid values like 0 (zero) * Reduce the amount of messages per page users can select
- Loading branch information
1 parent
b12cd1e
commit fc0b459
Showing
7 changed files
with
108 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
ui/app/[locale]/kafka/[kafkaId]/topics/[topicId]/messages/ConnectedRefreshSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { RefreshInterval, RefreshSelector } from "@/components/RefreshSelector"; | ||
import { useLayoutEffect, useState } from "react"; | ||
import { createPortal } from "react-dom"; | ||
|
||
export function ConnectedRefreshSelector({ | ||
isRefreshing, | ||
isLive, | ||
refreshInterval, | ||
lastRefresh, | ||
onRefresh, | ||
onRefreshInterval, | ||
onToggleLive, | ||
}: { | ||
isRefreshing: boolean; | ||
isLive: boolean; | ||
refreshInterval: RefreshInterval; | ||
lastRefresh: Date | undefined; | ||
onRefresh: () => void; | ||
onRefreshInterval: (interval: RefreshInterval) => void; | ||
onToggleLive: (enable: boolean) => void; | ||
}) { | ||
const [container, setContainer] = useState<Element | undefined>(); | ||
|
||
function seekContainer() { | ||
const el = document.getElementById("topic-header-portal"); | ||
if (el) { | ||
setContainer(el); | ||
} else { | ||
setTimeout(seekContainer, 100); | ||
} | ||
} | ||
|
||
useLayoutEffect(seekContainer, []); // we want to run this just once | ||
|
||
return container | ||
? createPortal( | ||
<RefreshSelector | ||
isRefreshing={isRefreshing} | ||
isLive={isLive} | ||
refreshInterval={refreshInterval} | ||
lastRefresh={lastRefresh} | ||
onRefresh={onRefresh} | ||
onToggleLive={onToggleLive} | ||
onIntervalChange={onRefreshInterval} | ||
/>, | ||
container, | ||
) | ||
: null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.