Skip to content

OLMIS-8257: Guard against missing window.applicationCache in app-cache controller#87

Merged
mgrochalskisoldevelo merged 1 commit into
masterfrom
OLMIS-8257-fix-app-cache-controller-crash
Jul 17, 2026
Merged

OLMIS-8257: Guard against missing window.applicationCache in app-cache controller#87
mgrochalskisoldevelo merged 1 commit into
masterfrom
OLMIS-8257-fix-app-cache-controller-crash

Conversation

@denys1204

Copy link
Copy Markdown
Contributor

Summary

Fix OpenlmisAppCacheController crashing when window.applicationCache is unavailable, which prevented the "Software last updated on" build date from rendering in the header.

Problem

The AppCache API (window.applicationCache) has been removed from modern browsers, so $window.applicationCache is undefined. $onInit called appCache.addEventListener before assigning vm.buildDate, throwing a TypeError and leaving vm.buildDate unset — so the build date never appeared.

Change

  • Guard every access to window.applicationCache ($onInit listener registration and setUpdateReady). $onInit now completes and sets vm.buildDate; the cache-update flow safely no-ops when AppCache is absent.
  • Add unit tests covering the missing-applicationCache case.

Testing

  • grunt build: lint clean, all unit tests pass (946/946).
  • Verified in reference-ui against uat.openlmis.org: the header shows the build date, e.g. "Software last updated on 16/07/2026"; console is clean, 4503/4503 tests pass.

Reference: originally fixed in the Eswatini distribution (OE-213), now moved upstream.

@sonarqubecloud

Copy link
Copy Markdown

@mgrochalskisoldevelo
mgrochalskisoldevelo merged commit 5dfe636 into master Jul 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants