utopia icon indicating copy to clipboard operation
utopia copied to clipboard

Remix BFF: Chain handlers

Open ruggi opened this issue 1 year ago • 3 comments

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).

ruggi avatar Mar 05 '24 15:03 ruggi

Try me

github-actions[bot] avatar Mar 05 '24 15:03 github-actions[bot]

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  Change 2 changes Regression 1 regression
                 Current
Job #10765
     Baseline
Job #10751
Regression  Initial JS 45.75MiB(~+0.01%) 45.75MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 20.31% 64.2%
No change  Chunks 35 35
No change  Assets 39 39
No change  Modules 4393 4393
No change  Duplicate Modules 523 523
No change  Duplicate Code 30.95% 30.95%
No change  Packages 467 467
No change  Duplicate Packages 58 58
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
Job #10765
     Baseline
Job #10751
Regression  JS 62.5MiB (~+0.01%) 62.5MiB
Improvement  HTML 12.72KiB (-0.39%) 12.77KiB

View job #10765 reportView feat/remix-bff-chain branch activityView project dashboard

relativeci[bot] avatar Mar 05 '24 15:03 relativeci[bot]

Performance test results: (Chart1)
(Chart2)

github-actions[bot] avatar Mar 05 '24 15:03 github-actions[bot]