Skip to content

Conversation

@zburke
Copy link
Member

@zburke zburke commented Nov 7, 2025

Static event handler functions are invoked synchronously during the render cycle to allow handler modules to either implement side-effects or return a component in order to interrupt the ordinary flow. Thus, handler modules must be pre-loaded and cached, which is accomplished here by leveraging the async getModules() call.

NB: renaming of things inside handlerService.js has not changed the implementation at all; rather, the new names reflect what these functions have always done.

Refs STCOR-635, STRIPES-999

Static event handler functions are invoked synchronously during the
render cycle to allow handler modules to either implement side-effects
or return a component in order to interrupt the ordinary flow. Thus,
handler modules must be pre-loaded and cached, which is accomplished
here by leveraging the async `getModules()` call.

NB: renaming of things inside `handlerService.js` has not changed the
implementation at all; rather, the new names reflect what these
functions have always done.

Refs STCOR-635, STRIPES-999
@zburke zburke requested a review from a team as a code owner November 7, 2025 21:47
@github-actions
Copy link

github-actions bot commented Nov 7, 2025

Jest Unit Test Results

  1 files  ±0   83 suites  +1   1m 42s ⏱️ +2s
495 tests +2  495 ✅ +2  0 💤 ±0  0 ❌ ±0 
501 runs  +2  501 ✅ +2  0 💤 ±0  0 ❌ ±0 

Results for commit 6f4b04a. ± Comparison against base commit 39726e7.

This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.
getEventHandler calls module's handler when it is defined ‑ getEventHandler calls module's handler when it is defined
getEventHandler does nothing in modules without handlers ‑ getEventHandler does nothing in modules without handlers
getEventHandlers returns handlers from modules that contain them ‑ getEventHandlers returns handlers from modules that contain them
getModules handles lazy builds ‑ getModules handles lazy builds
getModules handles monolithic builds ‑ getModules handles monolithic builds
handleEvent calls module's handler when it is defined ‑ handleEvent calls module's handler when it is defined
handleEvent does nothing in modules without handlers ‑ handleEvent does nothing in modules without handlers
invokeEventHandlers invokes event handler on modules that contain them ‑ invokeEventHandlers invokes event handler on modules that contain them

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

Bigtest Unit Test Results

150 tests  ±0   149 ✅ ±0   6s ⏱️ -3s
  1 suites ±0     1 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 6f4b04a. ± Comparison against base commit 39726e7.

This pull request removes 5 and adds 3 tests. Note that renamed tests count towards both.
      equal to check email label in english translation
      equal to check email precautions label in english translation
      equal to sent email precautions label in english translation
Chrome_142_0_0_0_(Linux_x86_64).Forgot username/password status test check email status page tests ‑ Forgot username/password status test check email status page tests should have the header with an appropriate text content
Chrome_142_0_0_0_(Linux_x86_64).Forgot username/password status test check email status page tests ‑ Forgot username/password status test check email status page tests should have the paragraph with an appropriate text content
Chrome_142_0_0_0_(Linux_x86_64).Forgot username/password status test check email status page tests ‑ Forgot username/password status test check email status page tests should have the header with an appropriate text content
      equal to check email label in english translation
Chrome_142_0_0_0_(Linux_x86_64).Forgot username/password status test check email status page tests ‑ Forgot username/password status test check email status page tests should have the paragraph with an appropriate text content
      equal to check email precautions label in english translation
Chrome_142_0_0_0_(Linux_x86_64).Forgot username/password status test check email status page tests ‑ Forgot username/password status test check email status page tests should have the paragraph with an appropriate text content
      equal to sent email precautions label in english translation

♻️ This comment has been updated with latest results.

@zburke zburke marked this pull request as draft November 9, 2025 11:59
When a bundle is constructed with `--lazy()`, the module-loader function
will be `getDynamicModule()` implemented with `import()` instead of
`getModule()` implemented with `require()`, i.e. the module-loader
function will be async. That offers the opportunity to implement
lazy-loading, but for FOLIO this has caveats:
* event-handler modules provide static methods, meaning they must be
  accessible synchronously during render
* plugin modules may need to be loaded synchronously due to how they are
  loaded in the UI

IOW, module loading cannot always be handled with lazy. Here, we take
the simple approach: pre-load everything, which may seem to fly in the
face of implementing code-splitting to begin with, but the end-goal here
is not, in fact code-splitting with separate webpack chunks, but
code-splitting with independently constructed module-federated bundles.
In that context, being able to load separate pieces is still a win.

We may eventually choose a more elaborate process for loading modules,
e.g. choosing to lazy-load applications but to pre-load other types, but
we're starting with a simple approach: pre-load everything.

Refs STCOR-635
@zburke zburke marked this pull request as ready for review November 19, 2025 12:35
@sonarqubecloud
Copy link

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