Skip to content

Commit c6a3fc5

Browse files
committed
Lint
1 parent 25de9bc commit c6a3fc5

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

frontend/src/routes/_account.plan.index.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// SPDX-License-Identifier: AGPL-3.0-only
44
// Please see LICENSE in the repository root for full details.
55

6+
import { queryOptions, useSuspenseQuery } from "@tanstack/react-query";
67
import { createFileRoute } from "@tanstack/react-router";
8+
import { useCallback, useEffect, useRef, useState } from "react";
79
import { graphql, useFragment } from "../gql";
810
import { graphqlRequest } from "../graphql";
9-
import { queryOptions, useSuspenseQuery } from "@tanstack/react-query";
10-
import { useEffect, useRef, useState } from "react";
1111

1212
export const CONFIG_FRAGMENT = graphql(/* GraphQL */ `
1313
fragment PlanManagement_siteConfig on SiteConfig {
@@ -43,18 +43,19 @@ function Plan(): React.ReactElement {
4343
}
4444

4545
const ref = useRef<HTMLIFrameElement>(null);
46-
const [height, setHeight] = useState('0px');
46+
const [height, setHeight] = useState("0px");
4747

4848
// Poll the size of the iframe content and set the height
4949
// This will only work where the iframe is served from the same origin
50-
const doHeight = () => {
51-
const height = ref.current?.contentWindow?.document.body.parentElement?.scrollHeight;
50+
const doHeight = useCallback(() => {
51+
const height =
52+
ref.current?.contentWindow?.document.body.parentElement?.scrollHeight;
5253
if (height) {
53-
setHeight(height + 'px');
54+
setHeight(`${height}px`);
5455
} else {
55-
setHeight('500px');
56+
setHeight("500px");
5657
}
57-
};
58+
}, []);
5859
useEffect(() => {
5960
doHeight();
6061

@@ -63,10 +64,11 @@ function Plan(): React.ReactElement {
6364
}, 1000);
6465

6566
return () => clearInterval(interval);
66-
}, []);
67+
}, [doHeight]);
6768

6869
return (
6970
<iframe
71+
title="asd"
7072
ref={ref}
7173
onLoad={doHeight}
7274
src={planManagementIframeUri}

frontend/tests/mocks/handlers.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
mockUserEmailListQuery,
3232
mockUserProfileQuery,
3333
} from "../../src/gql/graphql";
34+
import { CONFIG_FRAGMENT as PLAN_MANAGEMENT_CONFIG_FRAGMENT } from "../../src/routes/_account.plan.index";
3435

3536
export const handlers = [
3637
mockFooterQuery(() =>
@@ -82,11 +83,14 @@ export const handlers = [
8283
),
8384
),
8485

85-
siteConfig: makeFragmentData(
86-
{
87-
displayNameChangeAllowed: true,
88-
},
89-
USER_GREETING_CONFIG_FRAGMENT,
86+
siteConfig: Object.assign(
87+
makeFragmentData(
88+
{
89+
displayNameChangeAllowed: true,
90+
},
91+
USER_GREETING_CONFIG_FRAGMENT,
92+
),
93+
makeFragmentData({}, PLAN_MANAGEMENT_CONFIG_FRAGMENT),
9094
),
9195
},
9296
}),

0 commit comments

Comments
 (0)