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

mozilla / fx-private-relay / 235b20c9-178f-4a36-aaad-af2dbd35dfd4

09 Dec 2024 01:13AM CUT coverage: 85.057% (-0.009%) from 85.066%
235b20c9-178f-4a36-aaad-af2dbd35dfd4

Pull #5247

circleci

web-flow
Bump the nextjs group with 4 updates

Bumps the nextjs group with 4 updates: [@next/third-parties](https://github.com/vercel/next.js/tree/HEAD/packages/third-parties), [@next/eslint-plugin-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-plugin-next), [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) and [next](https://github.com/vercel/next.js).


Updates `@next/third-parties` from 15.0.3 to 15.0.4
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/commits/v15.0.4/packages/third-parties)

Updates `@next/eslint-plugin-next` from 15.0.3 to 15.0.4
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/commits/v15.0.4/packages/eslint-plugin-next)

Updates `eslint-config-next` from 15.0.3 to 15.0.4
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/commits/v15.0.4/packages/eslint-config-next)

Updates `next` from 15.0.3 to 15.0.4
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v15.0.3...v15.0.4)

---
updated-dependencies:
- dependency-name: "@next/third-parties"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: nextjs
- dependency-name: "@next/eslint-plugin-next"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: nextjs
- dependency-name: eslint-config-next
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: nextjs
- dependency-name: ne... (continued)
Pull Request #5247: Bump the nextjs group with 4 updates

2432 of 3561 branches covered (68.3%)

Branch coverage included in aggregate %.

16990 of 19273 relevant lines covered (88.15%)

9.92 hits per line

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

0.0
/frontend/src/components/Localized.tsx
1
// Imports of `Localized` from @fluent/react are forbidden because the component
2
// in this file should be used instead, but of course this component can use it
3
// just fine:
4
// eslint-disable-next-line no-restricted-imports
5
import { LocalizedProps, Localized as OriginalLocalized } from "@fluent/react";
×
6
import { cloneElement, isValidElement, useEffect, useState } from "react";
×
7
import { useL10n } from "../hooks/l10n";
×
8

9
/**
10
 * Wraps @fluent/react's Localized to be consistent between prerender and first render
11
 *
12
 * React will throw a tantrum if the HTML rendered during the build differs from
13
 * the DOM rendered by React when running client-side. However, at build-time we
14
 * don't yet know the user's locale. Thus, if we render strings in the user's
15
 * locale on the first client-side render, we'll make React unhappy, and who
16
 * wants that?
17
 *
18
 * To work around this, the useL10n hook makes sure that the English strings are
19
 * rendered when both prerendering and doing the first client-side render, and
20
 * only after that use the language that aligns with the user's preferences.
21
 * Thus, while pre-rendering and during the first client-side render, we call
22
 * out to that hook.
23
 *
24
 * This means tags embedded in the localised strings won't get added initially,
25
 * but since that's only for SEO and the initial render, that's acceptable.
26
 */
27
export const Localized = (props: LocalizedProps) => {
×
28
  const [isPrerendering, setIsPrerendering] = useState(true);
×
29
  const l10n = useL10n();
×
30

31
  useEffect(() => {
×
32
    setIsPrerendering(false);
×
33
  }, []);
34

35
  if (isPrerendering) {
×
36
    // `useL10n` makes sure that this is a prerenderable string
37
    return isValidElement(props.children) ? (
38
      cloneElement(
×
39
        props.children,
40
        {},
41
        <>{l10n.getString(props.id, props.vars)}</>,
42
      )
43
    ) : (
44
      <>{l10n.getString(props.id, props.vars)}</>
45
    );
46
  }
47

48
  return <OriginalLocalized {...props} />;
49
};
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

© 2025 Coveralls, Inc