diff --git a/hello-world-tab-with-backend/api/package.json b/hello-world-tab-with-backend/api/package.json index 03711fd74..658318935 100644 --- a/hello-world-tab-with-backend/api/package.json +++ b/hello-world-tab-with-backend/api/package.json @@ -24,7 +24,8 @@ }, "devDependencies": { "env-cmd": "^10.1.0", - "typescript": "^4.4.4" + "@types/node": "^20.17.12", + "typescript": "^5.6.3" }, "main": "dist/src/functions/*.js" } diff --git a/hello-world-tab-with-backend/api/tsconfig.json b/hello-world-tab-with-backend/api/tsconfig.json index 74d4d4871..d3fbe2546 100644 --- a/hello-world-tab-with-backend/api/tsconfig.json +++ b/hello-world-tab-with-backend/api/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "module": "commonjs", - "target": "es6", + "module": "NodeNext", + "target": "ES2022", "outDir": "dist", "rootDir": ".", "sourceMap": true, @@ -9,6 +9,6 @@ "typeRoots": ["./node_modules/@types"], "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "moduleResolution": "nodenext", + "moduleResolution": "NodeNext" } -} +} \ No newline at end of file diff --git a/hello-world-tab-with-backend/src/components/sample/lib/useData.ts b/hello-world-tab-with-backend/src/components/sample/lib/useData.ts index 145f3c9d2..87e34067c 100644 --- a/hello-world-tab-with-backend/src/components/sample/lib/useData.ts +++ b/hello-world-tab-with-backend/src/components/sample/lib/useData.ts @@ -64,7 +64,10 @@ export function useData( .catch((error) => dispatch({ type: "error", error })); } useEffect(() => { + // Intentionally run only once on mount to auto-fetch initial data. + // We don't want to re-fetch when `auto` or `reload` changes. if (auto) reload(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return { data, loading, error, reload }; -} +} \ No newline at end of file diff --git a/hello-world-tab-with-backend/src/components/sample/lib/useTeams.ts b/hello-world-tab-with-backend/src/components/sample/lib/useTeams.ts index 335963d8a..de1cbdfb6 100644 --- a/hello-world-tab-with-backend/src/components/sample/lib/useTeams.ts +++ b/hello-world-tab-with-backend/src/components/sample/lib/useTeams.ts @@ -68,7 +68,11 @@ export function useTeams(options?: { ? options.setThemeHandler : themeChangeHandler; useEffect(() => { - // set initial theme based on options or query string + // Intentionally run only once on mount to initialize Teams SDK and register event handlers. + // Teams SDK initialization and event registration should not be repeated on re-renders. + // The initial theme is captured once via useState, so it won't cause stale closure issues. + + // Set initial theme based on options or query string if (initialTheme) { overrideThemeHandler(initialTheme); } @@ -100,10 +104,11 @@ export function useTeams(options?: { setLoading(false); setInTeams(false); }); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return [ { inTeams, fullScreen, theme, context, themeString, loading }, { setTheme: overrideThemeHandler }, ]; -} +} \ No newline at end of file diff --git a/intelligent-data-chart-generator/api/package.json b/intelligent-data-chart-generator/api/package.json index b51b514e0..4f205c037 100644 --- a/intelligent-data-chart-generator/api/package.json +++ b/intelligent-data-chart-generator/api/package.json @@ -16,7 +16,8 @@ }, "devDependencies": { "env-cmd": "^10.1.0", - "typescript": "^4.9.5" + "@types/node": "^20.17.12", + "typescript": "^5.6.3" }, "main": "dist/src/functions/*.js" } diff --git a/intelligent-data-chart-generator/api/tsconfig.json b/intelligent-data-chart-generator/api/tsconfig.json index 3cae9e878..cd4281ec3 100644 --- a/intelligent-data-chart-generator/api/tsconfig.json +++ b/intelligent-data-chart-generator/api/tsconfig.json @@ -1,17 +1,15 @@ { "compilerOptions": { - "module": "commonjs", - "target": "es6", + "module": "NodeNext", + "target": "ES2022", "outDir": "dist", "rootDir": ".", "sourceMap": true, "strict": false, "esModuleInterop": true, "resolveJsonModule": true, - "typeRoots": [ - "./node_modules/@types" - ], + "typeRoots": ["./node_modules/@types"], "allowSyntheticDefaultImports": true, - "moduleResolution": "nodenext", + "moduleResolution": "NodeNext" } } \ No newline at end of file