mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Fix: Check explicitly for arrays and strings on size formatter
"length" in data was a brittle check that failed for scalar values.
This commit is contained in:
@@ -5,7 +5,7 @@ import Block from "components/services/widget/block";
|
||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||
|
||||
function getLength(data) {
|
||||
if ("length" in data) {
|
||||
if (Array.isArray(data) || typeof data === "string") {
|
||||
return data.length;
|
||||
} else if (typeof data === "object" && data !== null) {
|
||||
return Object.keys(data).length;
|
||||
|
||||
Reference in New Issue
Block a user