Skip to content

Commit 7989c62

Browse files
authored
New data model load file content fix (#693) (#694)
1 parent 2e062ae commit 7989c62

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Installing this extension will also make the latest Power Platform CLI (aka pac)
1919
[Power Platform CLI Exposed](https://www.youtube.com/playlist?list=PLlrxD0HtieHhEdLHxQOU96ySSZpMCyAxf)
2020

2121
## Release Notes
22+
2.0.7:
23+
- QFE for styling files load for new data model schema
24+
2225
2.0.6:
2326
- QFE for styles rendering of power pages sites
2427

src/web/client/common/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@ export enum SurveyConstants {
8484
SURVEY_NAME = "PowerPages-NPS",
8585
EVENT_NAME = "VscodeWeb",
8686
AUTHORIZATION_ENDPOINT = "https://microsoft.onmicrosoft.com/cessurvey/user",
87+
}
88+
89+
export enum portalSchemaVersion {
90+
V1 = "portalschemav1",
91+
V2 = "portalschemav2",
8792
}

src/web/client/dal/remoteFetchProvider.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
GetFileContent,
1010
GetFileNameWithExtension,
1111
getSanitizedFileName,
12+
isPortalVersionV1,
13+
isPortalVersionV2,
1214
isWebfileContentLoadNeeded,
1315
setFileContent,
1416
} from "../utilities/commonUtil";
@@ -515,11 +517,11 @@ async function fetchMappingEntityContent(
515517

516518
const result = await response.json();
517519
const data = result.value ?? result;
518-
if (result[Constants.ODATA_COUNT] !== 0 && data.length >= 1) {
520+
if (isPortalVersionV1() && result[Constants.ODATA_COUNT] > 0 && data.length > 0) {
519521
return data[0];
520522
}
521523

522-
return data ?? Constants.NO_CONTENT;
524+
return isPortalVersionV2() ? data : Constants.NO_CONTENT;
523525
}
524526

525527
export async function preprocessData(

src/web/client/utilities/commonUtil.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
DATA,
1010
MULTI_FILE_FEATURE_SETTING_NAME,
1111
NO_CONTENT,
12-
VERSION_CONTROL_FOR_WEB_EXTENSION_SETTING_NAME
12+
VERSION_CONTROL_FOR_WEB_EXTENSION_SETTING_NAME,
13+
portalSchemaVersion
1314
} from "../common/constants";
1415
import { IAttributePath } from "../common/interfaces";
1516
import { schemaEntityName } from "../schema/constants";
@@ -168,4 +169,12 @@ export function isWebfileContentLoadNeeded(fileName: string, fsPath: string): bo
168169
return fileExtension !== undefined ?
169170
validImageExtensions.includes(fileExtension.toLowerCase()) ||
170171
doesFileExist(fsPath) : false;
172+
}
173+
174+
export function isPortalVersionV1(): boolean {
175+
return WebExtensionContext.currentSchemaVersion.toLowerCase() === portalSchemaVersion.V1;
176+
}
177+
178+
export function isPortalVersionV2(): boolean {
179+
return WebExtensionContext.currentSchemaVersion.toLowerCase() === portalSchemaVersion.V2;
171180
}

0 commit comments

Comments
 (0)