Chore: full react hooks eslint compliance (#7040)

This commit is contained in:
shamoon
2026-08-21 14:00:02 -07:00
committed by GitHub
parent 7c26cf6d97
commit 4c361422ca
111 changed files with 1072 additions and 867 deletions
+5 -10
View File
@@ -2,8 +2,12 @@ import Block from "components/services/widget/block";
import Container from "components/services/widget/container";
import useWidgetAPI from "utils/proxy/use-widget-api";
import withWidgetFields from "utils/widget-fields";
export default function Component({ service }) {
const DEFAULT_FIELDS = ["channels", "hd"];
export default function Component({ service: configuredService }) {
const service = withWidgetFields(configuredService, DEFAULT_FIELDS);
const { widget } = service;
const { tuner = 0 } = widget;
@@ -24,15 +28,6 @@ export default function Component({ service }) {
);
}
// Provide a default if not set in the config
if (!widget.fields) {
widget.fields = ["channels", "hd"];
}
// Limit to a maximum of 4 at a time
if (widget.fields.length > 4) {
widget.fields = widget.fields.slice(0, 4);
}
return (
<Container service={service}>
<Block label="hdhomerun.channels" value={channelsData?.length} />
+1 -1
View File
@@ -58,7 +58,7 @@ describe("widgets/hdhomerun/component", () => {
const { container } = renderWithProviders(<Component service={service} />, { settings: { hideErrors: false } });
expect(service.widget.fields).toEqual(["channels", "hd", "tunerCount", "channelNumber"]);
expect(service.widget.fields).toEqual(["channels", "hd", "tunerCount", "channelNumber", "signalStrength"]);
expect(container.querySelectorAll(".service-block")).toHaveLength(4);
expect(screen.getByText("hdhomerun.channels")).toBeInTheDocument();
expect(screen.getByText("hdhomerun.hd")).toBeInTheDocument();