Skip to content

Commit 06be4ff

Browse files
committed
only perform getPinboardsByPaths for paths it hasn't already looked-up
1 parent bf3213e commit 06be4ff

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

client/src/fronts/frontsIntegration.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ export const FrontsIntegration = ({
3636
{} as { [path: string]: PinboardData }
3737
);
3838
useEffect(() => {
39-
const paths = Object.keys(pathToElementsMap);
40-
paths.length > 0 &&
39+
const pathsYetToBeLookedUp = Object.keys(pathToElementsMap).filter(
40+
(path) => !pathToPinboardDataMap[path]
41+
);
42+
pathsYetToBeLookedUp.length > 0 &&
4143
apolloClient
4244
.query({
4345
query: gqlGetPinboardsByPaths,
4446
variables: {
45-
paths,
47+
paths: pathsYetToBeLookedUp,
4648
},
4749
})
4850
.then(({ data }) => {

0 commit comments

Comments
 (0)