Skip to content

Commit 306ed0f

Browse files
committed
Refresh array
1 parent 849b309 commit 306ed0f

File tree

1 file changed

+14
-3
lines changed
  • plugins/hubspot/src/pages/canvas

1 file changed

+14
-3
lines changed

plugins/hubspot/src/pages/canvas/CMS.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default function CMSPage() {
1414
const loadCollections = async () => {
1515
try {
1616
const allCollections = await framer.getCollections()
17-
const thisPluginCollections = allCollections.filter(collection => collection.managedBy === "thisPlugin")
18-
setCollections(thisPluginCollections)
17+
const hubSpotCollections = allCollections.filter(collection => collection.managedBy === "thisPlugin")
18+
setCollections(hubSpotCollections)
1919
} catch (error) {
2020
console.error("Failed to load collections:", error)
2121
framer.notify("Failed to load collections", { variant: "error" })
@@ -25,7 +25,16 @@ export default function CMSPage() {
2525
}
2626

2727
useEffect(() => {
28+
const handleWindowFocus = () => {
29+
void loadCollections()
30+
}
31+
32+
window.addEventListener("focus", handleWindowFocus)
2833
void loadCollections()
34+
35+
return () => {
36+
window.removeEventListener("focus", handleWindowFocus)
37+
}
2938
}, [])
3039

3140
const handleCollectionClick = (collectionId: string) => {
@@ -45,7 +54,9 @@ export default function CMSPage() {
4554
[
4655
{
4756
label: "Open Collection",
48-
onAction: () => void handleCollectionClick(collectionId),
57+
onAction: () => {
58+
handleCollectionClick(collectionId)
59+
},
4960
},
5061
],
5162
{

0 commit comments

Comments
 (0)