-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STCOR-759 read okapi config from micro-stripes-config (#1366)
A service worker's global state is reset after each sleep/wake cycle, meaning the `okapiUrl` and `okapiTenant` values so lovingly sent to the service worker during registration are likely to be promptly forgotten as soon as the browser is idle for a few minutes and decides it would be good to clean up inactive processes. Here, those values are directly imported from a virtual module created at build-time by stripes-webpack, which forwards the values from the stripes-config object (most likely, the `stripes.config.js` file) and allows them to be compiled directly into the generated `service-worker.js` asset. An alternative approach would be to pass in those values as URL parameters when the service worker is registered. h/t @mkuklis and @JohnC-80 who did the heavy lifting here, both in thinking through the potential solutions and actually figuring out how to implement this in our highly customized build process. * Requires folio-org/stripes-webpack/pull/132 Refs STCOR-759 --------- Co-authored-by: Michal Kuklis <[email protected]>
- Loading branch information
Showing
10 changed files
with
76 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
jest.mock('micro-stripes-config', () => ({ | ||
okapiUrl: 'https://los-alamos-barbie-has-a-nice-tan.oh-wa.it', | ||
okapiTenant: 'kenough', | ||
}), | ||
{ virtual: true }); |