fix: use SuperJSON for cache persistence and add null guards to all widgets
SuperJSON preserves Date/Map/Set types through the Redis cache round-trip, fixing RangeError crashes from date formatting. Added defensive null/undefined guards across all widget components to handle useQuery loading states and potential cache shape mismatches.
This commit is contained in:
31 files changed
+124
-117
No files matched your search
@@ -27,7 +27,7 @@ export function QueuePanel(props: QueuePanelProps) {
|
||||
|
||||
const t = useI18n("widget.mediaTranscoding.panel.queue");
|
||||
|
||||
if (queue.array.length === 0) {
|
||||
if ((queue.array ?? []).length === 0) {
|
||||
return (
|
||||
<Center style={{ flex: "1" }}>
|
||||
<Title order={6}>{t("empty")}</Title>
|
||||
@@ -53,7 +53,7 @@ export function QueuePanel(props: QueuePanelProps) {
|
||||
</TableTr>
|
||||
</TableThead>
|
||||
<TableTbody>
|
||||
{queue.array.map((item) => (
|
||||
{(queue.array ?? []).map((item) => (
|
||||
<TableTr key={item.id}>
|
||||
<TableTd py={2}>
|
||||
<Group gap={4} wrap="nowrap">
|
||||
|
||||
@@ -26,7 +26,7 @@ interface WorkersPanelProps {
|
||||
export function WorkersPanel(props: WorkersPanelProps) {
|
||||
const t = useI18n("widget.mediaTranscoding.panel.workers");
|
||||
|
||||
if (props.workers.length === 0) {
|
||||
if ((props.workers ?? []).length === 0) {
|
||||
return (
|
||||
<Center style={{ flex: "1" }}>
|
||||
<Title order={6}>{t("empty")}</Title>
|
||||
|
||||
Reference in new issue
Block a user