utopia
utopia copied to clipboard
Remix BFF: Chain handlers
Fix #4994
Problem:
As discussed here we need a way to apply middlewares to the Remix API routes.
Fix:
This PR adds the Chain concept to the current handling logic.
- A chain is just an ordered sequence of equivalent handlers
- If a handler throws an exception in the chain, the chain stops
- The last return value of the chain is returned to the client
- The handlers can share state via the chain's
context
Notes
The diff is large, but it's pure refactoring noise, except for api.server.ts (the very first commit).
Job #10765: Bundle Size — 62.51MiB (~-0.01%).
6b8d770(current) vs 2296c28 master#10751(baseline)
[!WARNING] Bundle contains 58 duplicate packages – View duplicate packages
Bundle metrics 
2 changes 
1 regression
| Current Job #10765 |
Baseline Job #10751 |
|
|---|---|---|
45.75MiB(~+0.01%) |
45.75MiB |
|
0B |
0B |
|
20.31% |
64.2% |
|
35 |
35 |
|
39 |
39 |
|
4393 |
4393 |
|
523 |
523 |
|
30.95% |
30.95% |
|
467 |
467 |
|
58 |
58 |
Bundle size by type 
2 changes 
1 regression 
1 improvement
| Current Job #10765 |
Baseline Job #10751 |
|
|---|---|---|
62.5MiB (~+0.01%) |
62.5MiB |
|
12.72KiB (-0.39%) |
12.77KiB |
View job #10765 report View feat/remix-bff-chain branch activity View project dashboard
Performance test results:
