Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
73db878
use user Profile instead of user
ghazwarhili Jun 8, 2026
baeeed9
fix prettier
ghazwarhili Jun 8, 2026
9dd48f7
Avoid booting the full app inside the OIDC silent-renew iframe
ghazwarhili Jun 16, 2026
ef22603
Merge branch 'main' into cleanup-apache-config-requests
ghazwarhili Jun 16, 2026
a54b761
avoid loading full app bundle in silent renew iframe
ghazwarhili Jun 18, 2026
e4dd15c
Merge remote-tracking branch 'origin/cleanup-apache-config-requests' …
ghazwarhili Jun 18, 2026
c5763d4
Merge branch 'main' into cleanup-apache-config-requests
ghazwarhili Jun 18, 2026
cd6282a
serve a minimal HTML on the silent renew callback route
ghazwarhili Jun 18, 2026
1ce33c8
Revert "serve a minimal HTML on the silent renew callback route"
ghazwarhili Jun 23, 2026
e03e98f
Merge branch 'main' into cleanup-apache-config-requests
ghazwarhili Jun 23, 2026
b347286
rabbit remarks
ghazwarhili Jun 23, 2026
a29740d
typo fix
ghazwarhili Jun 23, 2026
cb0b3bf
Merge branch 'main' into cleanup-apache-config-requests
ghazwarhili Jun 24, 2026
044337b
code review remarks
ghazwarhili Jun 24, 2026
75bfe03
Merge branch 'main' into cleanup-apache-config-requests
ghazwarhili Jun 24, 2026
0f75bc9
code review remarks
ghazwarhili Jun 24, 2026
e36f369
Revert "code review remarks"
ghazwarhili Jun 24, 2026
44682cc
upgrade commons-ui version
ghazwarhili Jun 25, 2026
94e3d60
Merge branch 'main' into cleanup-apache-config-requests
ghazwarhili Jun 25, 2026
ee75d93
fix sonar issue
ghazwarhili Jun 25, 2026
782e607
Merge remote-tracking branch 'origin/cleanup-apache-config-requests' …
ghazwarhili Jun 25, 2026
445ac89
fix sonar issue
ghazwarhili Jun 25, 2026
132e553
fix sonar issue
ghazwarhili Jun 25, 2026
6e1b052
fix sonar issue
ghazwarhili Jun 25, 2026
7b9e186
Merge branch 'main' into cleanup-apache-config-requests
etiennehomer Jul 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<body class="singlestretch-parent singlestretch-child">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" class="singlestretch-parent singlestretch-child"></div>
<script type="module" src="/src/index.jsx"></script>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@grgit idsuite/commons-ui": "0.237.0",
"@gridsuite/commons-ui": "0.240.0",
Comment on lines +14 to 15

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Malformed dependency key breaks npm install.

Line 14 declares "@GRGit idsuite/commons-ui" — an invalid npm package name (contains a space, likely a corrupted rename of @gridsuite/commons-ui). npm package names must match a strict pattern (no spaces), so npm install/npm ci will fail. Additionally, line 15 already declares the real @gridsuite/commons-ui dependency but pinned to 0.240.0, which conflicts with the PR objective stating the version bump is to 0.237.0.

This looks like a bad merge/diff artifact rather than an intentional change.

🐛 Proposed fix
-        "`@grgit` idsuite/commons-ui": "0.237.0",
-        "`@gridsuite/commons-ui`": "0.240.0",
+        "`@gridsuite/commons-ui`": "0.237.0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@grgit idsuite/commons-ui": "0.237.0",
"@gridsuite/commons-ui": "0.240.0",
"`@gridsuite/commons-ui`": "0.237.0",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 14 - 15, The dependency entry is malformed and
causes npm to reject the manifest: in package.json, fix the corrupted `@grgit`
idsuite/commons-ui key to the valid `@gridsuite/commons-ui` name, and make sure
the version for `@gridsuite/commons-ui` matches the intended bump to 0.237.0
rather than 0.240.0. Keep only the correctly named dependency entry so npm
install/npm ci can parse the package manifest successfully.

"@hello-pangea/dnd": "^18.0.1",
"@hookform/resolvers": "^4.1.3",
Expand Down
42 changes: 42 additions & 0 deletions src/components/silent-renew.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { useCallback, useEffect, useState } from 'react';
import type { UserManager } from 'oidc-client-ts';
import {
handleSilentRenewCallback,
initializeAuthenticationProd,
SilentRenewCallbackHandler,
} from '@gridsuite/commons-ui';
import { getCachedIdpSettings } from 'services/utils';

export default function SilentRenew() {
const [userManager, setUserManager] = useState<UserManager | null>(null);

useEffect(() => {
initializeAuthenticationProd(
Comment thread
ghazwarhili marked this conversation as resolved.
() => undefined /* dispatch: unused when isSilentRenew=true */,
true /* isSilentRenew */,
getCachedIdpSettings /* reads the cache instead of fetching idpSettings.json */,
false /* isSigningCallback */
)
.then(setUserManager)
.catch((e) => console.error('Silent renew init failed:', e));
}, []);

const handleSilentRenewCallbackClosure = useCallback(() => {
if (userManager) {
handleSilentRenewCallback(userManager);
}
}, [userManager]);

return (
<SilentRenewCallbackHandler
userManager={userManager}
handleSilentRenewCallback={handleSilentRenewCallbackClosure}
/>
);
}
22 changes: 0 additions & 22 deletions src/index.jsx

This file was deleted.

28 changes: 28 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2020, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { createRoot } from 'react-dom/client';
import SilentRenew from './components/silent-renew';
import { SILENT_RENEW_CALLBACK_PATH } from './services/utils';

const container = document.getElementById('root');
const root = createRoot(container!);

if (globalThis.location.pathname.endsWith(SILENT_RENEW_CALLBACK_PATH)) {
root.render(<SilentRenew />);
} else {
Promise.all([
import('core-js/es/array/flat-map'),
import('typeface-roboto'),
import('@xyflow/react/dist/base.css'),
import('./index.css'),
import('./configure-yup-init'),
import('./components/app-wrapper'),
]).then(([, , , , , { default: AppWrapper }]) => {
root.render(<AppWrapper />);
});
}
8 changes: 8 additions & 0 deletions src/module-core-js-array-flat-map.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

declare module 'core-js/es/array/flat-map';
8 changes: 8 additions & 0 deletions src/module-typeface-roboto.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

declare module 'typeface-roboto';
35 changes: 31 additions & 4 deletions src/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { catchErrorHandler, fetchStudyMetadata, StudyMetadata } from '@gridsuite/commons-ui';
import { catchErrorHandler, fetchStudyMetadata, IdpSettings, StudyMetadata } from '@gridsuite/commons-ui';
export const FetchStatus = {
SUCCEED: 'SUCCEED',
FAILED: 'FAILED',
Expand All @@ -13,7 +13,8 @@ export const FetchStatus = {
};

export const MAX_INT32: number = 2147483647;

const IDP_SETTINGS_CACHE_KEY = 'gridsuite-idp-settings';
export const SILENT_RENEW_CALLBACK_PATH = '/silent-renew-callback';
type DefaultParameters = StudyMetadata['defaultParametersValues'];
export const getWsBase = () => document.baseURI.replace(/^http:\/\//, 'ws://').replace(/^https:\/\//, 'wss://');

Expand Down Expand Up @@ -49,8 +50,34 @@ function fetchEnv() {
return fetch('env.json').then((res) => res.json());
}

export function fetchIdpSettings() {
return fetch('idpSettings.json').then((res) => res.json());
// Always hits the network: picks up config changes on each full app load
// AND refreshes the cache read by the silent-renew iframe.
export function fetchIdpSettings(): Promise<IdpSettings> {
return fetch('idpSettings.json')
.then((res) => res.json())
.then((settings: IdpSettings) => {
try {
localStorage.setItem(IDP_SETTINGS_CACHE_KEY, JSON.stringify(settings));
} catch (e) {
console.warn('Failed to cache IdP settings:', e);
}
return settings;
});
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// Used only on the silent-renew path: reads the cache (no network),
// falls back to a real fetch if the cache is missing/corrupted.
export function getCachedIdpSettings(): Promise<IdpSettings> {
try {
const cached = localStorage.getItem(IDP_SETTINGS_CACHE_KEY);
if (cached) {
return Promise.resolve(JSON.parse(cached) as IdpSettings);
}
} catch (e) {
// localStorage unavailable, or cache corrupted -> fall back to fresh fetch
console.warn('Failed to read cached IdP settings:', e);
}
return fetchIdpSettings();
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

export function fetchVersion() {
Expand Down
Loading