Open stz184 opened 3 years ago
Merging #90 (1d209eb) into master (e593e5d) will decrease coverage by
0.77%
. The diff coverage is84.84%
.
@@ Coverage Diff @@
## master #90 +/- ##
==========================================
- Coverage 94.01% 93.24% -0.78%
==========================================
Files 20 20
Lines 301 311 +10
Branches 47 51 +4
==========================================
+ Hits 283 290 +7
- Misses 18 21 +3
I am currently working on fixing the tests.
Why
Currently, mockit starts a development server on production and expects webpack to reload the page every time when
./config/routes.json
is modified. Yes, it works, but it is fundamentally wrong, it makes pointless the use of react and SPA principles, reveals configuration and code errors, it does not respect "homepage" property inpackage.json
which makes the app impossible to be used inside a subdirectory. It is like making a coffee in a microwave oven - yes, it will probably brew, but it will not have the taste of the coffee prepared on an espresso machine.How How I fixed it? Easily. First, the backend server is now extended with a new route called
/routes
that basically returns what we have inroutes.json
. This endpoint is called withfetch
to retrieve the routes and settings instead of reading directly the file. As an added benefit, you can now deploy the backend server and the fronted app on completely different physical machines and the whole MockIt app will still work.I have also used
useCallback
hook to avoid unnecessary component rerenderings.There are some outstanding issues making the app works properly inside subfolder, but I will place yet another PR if this one is well accepted.