• 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/api/ExperimentIdLink.js
1
import { setContext } from '@apollo/client/link/context/index';
2
import experimentVersionFragment from '#src/graphql/fragments/experimentVersion.graphql';
3
// import { UIAB_COOKIE_NAME } from '#src/util/experiment/experimentUtils';
4

5
// Experiment assignments that will be passed in the X-Experiment Header
6
const targetIds = [
×
7
        'EXP-ML-Service-Bandit-LendByCategory',
8
        'EXP-FLSS-Ongoing-Sitewide-3'
9
];
10

11
function buildExpHeaders(cache) {
12
        const experimentAssignments = [];
×
13

14
        targetIds.forEach(id => {
×
15
                const exp = cache?.readFragment({
×
16
                        id: `Experiment:${id}`,
17
                        fragment: experimentVersionFragment,
18
                }) ?? {};
19

20
                if (exp.version) {
×
21
                        experimentAssignments.push(`${id};${exp.version}`);
×
22
                }
23
        });
24

25
        return experimentAssignments.join();
×
26
}
27

28
export default ({ cookieStore }) => {
29
        return setContext((operation, previousContext) => {
×
NEW
30
                if (!cookieStore) return previousContext;
×
31

32
                // Initialize new context
33
                const newContext = { ...previousContext };
×
34
                newContext.headers = newContext.headers ?? {};
×
35

36
                // Fetch experiment header values
37
                const experimentHeader = buildExpHeaders(previousContext?.cache);
×
38
                // TODO: Uncomment once X-UIAB header is allowed by the API
39
                // const uiabValue = cookieStore.get(UIAB_COOKIE_NAME) ?? '';
40

41
                // Add headers to context and pass along
42
                if (experimentHeader) {
×
43
                        newContext.headers['X-Experiments'] = experimentHeader;
×
44
                }
45
                // if (uiabValue) {
46
                //         newContext.headers['X-UIAB'] = uiabValue;
47
                // }
48

49
                return newContext;
×
50
        });
51
};
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