• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kiva / ui / 15721249898

18 Jun 2025 12:51AM UTC coverage: 52.564% (+4.7%) from 47.872%
15721249898

Pull #6091

github

web-flow
Merge 1f8983303 into e6c7ae52e
Pull Request #6091: feat: cacheable server-side rendering

1789 of 3594 branches covered (49.78%)

Branch coverage included in aggregate %.

276 of 398 new or added lines in 38 files covered. (69.35%)

7 existing lines in 4 files now uncovered.

2629 of 4811 relevant lines covered (54.65%)

280.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/server-entry.js
1
import fetch from 'make-fetch-happen';
2
import CookieStore from '#src/util/cookieStore';
3
import KvAuth0, { MockKvAuth0 } from '#src/util/KvAuth0';
4
import logFormatter from '#src/util/logFormatter';
5
import renderESI from '#src/server-esi-render';
6
import renderPage from '#src/server-app-render';
7

8
// custom fetch wrapper to log fetch requests
9
const customFetch = async (uri, options) => {
×
10
        const response = await fetch(uri, options);
×
11
        // Log the outgoing options
12
        logFormatter(`Fetch Options: ${uri}, Options: ${JSON.stringify(options)}`);
×
13

14
        // Log the full response
15
        // eslint-disable-next-line max-len
16
        logFormatter(`Server fetch: ${uri}, Status: ${response.status}, Headers: ${JSON.stringify(response.headers.raw())}`);
×
17

18
        return response;
×
19
};
20

21
// This exported function will be called by vue-render.
22
// This is where we perform data-prefetching to determine the
23
// state of our application before actually rendering it.
24
// Since data fetching is async, this function is expected to
25
// return a Promise that resolves to the rendered html and set cookies.
26
export default async context => {
27
        const {
28
                esi,
29
                config,
30
                cookies,
31
                user,
UNCOV
32
        } = context;
×
UNCOV
33
        const { accessToken, ...profile } = user;
×
34

35
        // Create cookie store with cookies passed from express middleware
36
        const cookieStore = new CookieStore(cookies);
×
37

38
        let kvAuth0;
39
        if (config.auth0.enable) {
×
40
                kvAuth0 = new KvAuth0({
×
41
                        accessToken,
42
                        checkFakeAuth: config.auth0.checkFakeAuth,
43
                        cookieStore,
44
                        domain: config.auth0.domain,
45
                        user: profile,
46
                });
47
        } else {
48
                kvAuth0 = MockKvAuth0;
×
49
        }
50

NEW
51
        const renderingOptions = {
×
52
                cookieStore,
53
                context,
54
                fetch: config?.apolloQueryFetchLogging ? customFetch : fetch,
×
55
                kvAuth0,
56
        };
57

NEW
58
        if (esi) {
×
NEW
59
                return renderESI(renderingOptions);
×
60
        }
NEW
61
        return renderPage(renderingOptions);
×
62
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc