@sapui5/sap.fe.navigation 1.150.0 → 1.152.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,7 +31,7 @@ type ShellAppState = {
31
31
  getKey(): string;
32
32
  setData(obj: object): void;
33
33
  getData(): InnerAppData;
34
- save(): JQuery.Promise<string>;
34
+ save(): Promise<undefined>;
35
35
  };
36
36
  /**
37
37
  * Structure of stored app state.
@@ -560,7 +560,8 @@ export class NavigationHandler extends BaseObject {
560
560
  * <li><code>oAppData.customData</code></li>
561
561
  * </ul>
562
562
  * which return the inner app data as stored in {@link #.navigate navigate} or {@link #.storeInnerAppStateAsync storeInnerAppStateAsync}.
563
- * <code>oAppData.oDefaultedSelectionVariant</code> is an empty selection variant and
563
+ * <code>oAppData.oDefaultedSelectionVariant</code> is populated with the user default values when they are
564
+ * available (fetched from the cross-app state), otherwise it is an empty selection variant, and
564
565
  * <code>oAppData.bNavSelVarHasDefaultsOnly</code> is <code>false</code> in this case.<br>
565
566
  * <b>Note:</b> If the navigation type is {@link sap.fe.navigation.NavType.initial} oAppData is an empty object!<br>
566
567
  * If an error occurs, an error object of type {@link sap.fe.navigation.NavError}, URL parameters (if available)
@@ -1097,7 +1098,10 @@ export class NavigationHandler extends BaseObject {
1097
1098
  this._oLastSavedInnerAppData.iCacheHit++;
1098
1099
 
1099
1100
  // replace inner app hash with cached appStateKey in url (just in case the app has changed the hash in meantime)
1100
- fnReplaceHash(sAppStateKeyCached);
1101
+ // bSkipHashReplace must be checked here too, same as in the cache-miss paths below
1102
+ if (!bSkipHashReplace) {
1103
+ fnReplaceHash(sAppStateKeyCached);
1104
+ }
1101
1105
  oMyDeferred.resolve(sAppStateKeyCached);
1102
1106
  return oMyDeferred.promise();
1103
1107
  }
@@ -1796,17 +1800,26 @@ export class NavigationHandler extends BaseObject {
1796
1800
  oAppState: ShellAppState,
1797
1801
  fnOnError?: Function
1798
1802
  ): { appStateKey: string; promise: JQuery.Promise<string> } | undefined {
1803
+ const oAppStatePromise = jQuery.Deferred();
1799
1804
  const sAppStateKey = oAppState.getKey();
1800
1805
  const oAppDataForSave = this._fetchAppDataForSave(oAppData, fnOnError);
1801
1806
  if (!oAppDataForSave) {
1802
1807
  return undefined;
1803
1808
  }
1804
1809
  oAppState.setData(oAppDataForSave);
1805
- const oSavePromise = oAppState.save();
1810
+ oAppState
1811
+ .save()
1812
+ .then(function () {
1813
+ oAppStatePromise.resolve();
1814
+ return;
1815
+ })
1816
+ .catch(function (oError) {
1817
+ oAppStatePromise.reject(oError);
1818
+ });
1806
1819
 
1807
1820
  return {
1808
1821
  appStateKey: sAppStateKey,
1809
- promise: oSavePromise.promise()
1822
+ promise: oAppStatePromise.promise()
1810
1823
  };
1811
1824
  }
1812
1825
 
@@ -1915,6 +1928,7 @@ export class NavigationHandler extends BaseObject {
1915
1928
  if (typeof oAppDataLoaded === "undefined") {
1916
1929
  const oError = oNavHandler._createTechnicalError("NavigationHandler.getDataFromAppState.failed");
1917
1930
  oDeferred.reject(oError, {}, navType);
1931
+ return;
1918
1932
  } else if (oNavHandler._sMode === Mode.ODataV2) {
1919
1933
  oAppData = {
1920
1934
  selectionVariant: "{}",
@@ -1964,22 +1978,26 @@ export class NavigationHandler extends BaseObject {
1964
1978
  oAppData.selectionVariant = oNavHandler._ensureSelectionVariantFormatString(oAppDataLoaded.selectionVariant);
1965
1979
  oAppData.oSelectionVariant = new SelectionVariant(oAppData.selectionVariant);
1966
1980
  }
1981
+ }
1967
1982
 
1968
- if (navType === NavType.iAppState) {
1969
- const oComponentData = oNavHandler.oComponent.getComponentData() as Record<string, any>;
1970
- const oStartupParameters = oComponentData?.startupParameters as Record<string, any>;
1971
- const bHasDefaultedParams = oStartupParameters?.[DEFAULTED_PARAMETER_PROPERTY]?.length > 0;
1972
- const bHasXAppState = oComponentData?.["sap-xapp-state"] !== undefined;
1973
-
1974
- if (bHasDefaultedParams && bHasXAppState) {
1975
- oNavHandler._enrichDefaultedSelectionVariant(
1976
- oAppData,
1977
- oStartupParameters[DEFAULTED_PARAMETER_PROPERTY][0],
1978
- oDeferred,
1979
- navType
1980
- );
1981
- return;
1982
- }
1983
+ // On an iAppState reload (F5), FLP still passes the defaulted parameter names but not their
1984
+ // values, so oDefaultedSelectionVariant would be empty. Re-fetch the original defaults from the
1985
+ // xAppState. This runs after the V2/V4 if/else so it applies to both ODataV2 (FEv2) and V4 apps
1986
+ // (it was previously inside the V4 branch only, which missed the ODataV2 path).
1987
+ if (navType === NavType.iAppState) {
1988
+ const oComponentData = oNavHandler.oComponent.getComponentData() as Record<string, any>;
1989
+ const oStartupParameters = oComponentData?.startupParameters as Record<string, any>;
1990
+ const bHasDefaultedParams = oStartupParameters?.[DEFAULTED_PARAMETER_PROPERTY]?.length > 0;
1991
+ const bHasXAppState = oComponentData?.["sap-xapp-state"] !== undefined;
1992
+
1993
+ if (bHasDefaultedParams && bHasXAppState) {
1994
+ oNavHandler._enrichDefaultedSelectionVariant(
1995
+ oAppData,
1996
+ oStartupParameters[DEFAULTED_PARAMETER_PROPERTY][0],
1997
+ oDeferred,
1998
+ navType
1999
+ );
2000
+ return;
1983
2001
  }
1984
2002
  }
1985
2003
 
@@ -147,7 +147,7 @@ sap.ui.define(["sap/ui/core/Lib", "sap/ui/core/library"], function (Library, _li
147
147
  name: "sap.fe.navigation",
148
148
  apiVersion: 2,
149
149
  // eslint-disable-next-line no-template-curly-in-string
150
- version: "1.150.0",
150
+ version: "1.152.0",
151
151
  dependencies: ["sap.ui.core"],
152
152
  types: ["sap.fe.navigation.NavType", "sap.fe.navigation.ParamHandlingMode", "sap.fe.navigation.SuppressionBehavior"],
153
153
  interfaces: [],