@hmcts/rpx-xui-common-lib 3.2.16 → 3.2.17-exui-4454

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.
@@ -2152,7 +2152,8 @@ class FilterService {
2152
2152
  persist(setting, persistence) {
2153
2153
  switch (persistence) {
2154
2154
  case 'local':
2155
- this.persistLocal(setting);
2155
+ // Backwards compatibility only, EXUI-4454: localStorage should not be used.
2156
+ this.persistSession(setting);
2156
2157
  break;
2157
2158
  case 'session':
2158
2159
  this.persistSession(setting);
@@ -2170,19 +2171,16 @@ class FilterService {
2170
2171
  if (sessionStorage.getItem(id)) {
2171
2172
  return JSON.parse(sessionStorage.getItem(id));
2172
2173
  }
2174
+ // Remove legacy persistent data without reading it back into the application.
2175
+ // Filter settings are user-associated and must not survive the browser session.
2173
2176
  if (localStorage.getItem(id)) {
2174
- if (this.isSameUser(id)) {
2175
- return JSON.parse(window.localStorage.getItem(id));
2176
- }
2177
- else {
2178
- return null;
2179
- }
2177
+ localStorage.removeItem(id);
2180
2178
  }
2181
2179
  return null;
2182
2180
  }
2183
2181
  isSameUser(id) {
2184
- const filterSetting = JSON.parse(window.localStorage.getItem(id));
2185
- return !!filterSetting.idamId && filterSetting.idamId === this.getUserId();
2182
+ void id;
2183
+ return false;
2186
2184
  }
2187
2185
  getStream(id) {
2188
2186
  if (!this.streams[id]) {
@@ -2200,10 +2198,6 @@ class FilterService {
2200
2198
  this.streams[id].next(null);
2201
2199
  }
2202
2200
  }
2203
- persistLocal(setting) {
2204
- setting.idamId = this.getUserId();
2205
- window.localStorage.setItem(setting.id, JSON.stringify(setting));
2206
- }
2207
2201
  persistSession(setting) {
2208
2202
  sessionStorage.setItem(setting.id, JSON.stringify(setting));
2209
2203
  }