Skip to content

Codemod React Intl islands change custom formatter SSR context and resource placement #2497

Closed

Description

@domgan-oai

Reproduction

The codemod built from 0d651902818c6011e1d86d3b52bce6739ec11b52 reports this component as clean Strong with compiler verification and project types. It emits an Intl-aware ReactCompat island.

import { FormattedMessage } from 'react-intl';

export function Case() {
  return (
    <section>
      <FormattedMessage
        id="more"
        defaultMessage="Read <mark>more</mark>"
        values={{ mark: chunks => <a href="#more">{chunks}</a> }}
      />
    </section>
  );
}

Supply a React Intl object whose formatter delegates to the stock formatter and wraps the rich result. In the original React tree, render Case under <Theme value="active"> and <RawIntlProvider value={intl}>.

import { createContext, createElement, useContext } from 'react';
import { preload } from 'react-dom';
import { createIntl } from 'react-intl';

const Theme = createContext('fallback');

function ThemeProbe({ children }) {
  return createElement('span', { 'data-theme': useContext(Theme) }, children);
}

const intl = createIntl({ locale: 'en' });
const format = intl.formatMessage;
intl.formatMessage = (...args) => {
  preload('/rich.png', { as: 'image' });
  return createElement(ThemeProbe, null, format(...args));
};

In the migrated tree, supply the same Intl object through the generated native RawIntlProvider and give the outer native theme context the same value. Compare full-document production React SSR with Octane's asynchronous prerender. The reproduction uses React 19.2.7, React Intl 7.1.14, and Octane 0.16.7.

Observed output

  • Original React SSR emits the preload in head and the formatter's span reads the outer theme.
  • Native Octane prerender retains the Intl object and the React descriptor for the link. It emits the preload inside the island host and the formatter's span reads the theme default.
  • Hosting the migrated component inside React's OctaneCompat on the server reaches the documented error for nested ReactCompat without an Octane-owned render request.
  • The control with a stock formatter preserves the visible localized text and link.

The codemod's current proof covers the authored substitution's descriptor. It does not establish which formatter will run or which contexts its returned React elements will read. A supported conversion needs an ownership proof for that work or an unresolved migration diagnostic.

Related to #2432, which preserves authored descriptors, and #2444, which concerns resource work in the locale getter.

Codex task · Host com-79386

Activity

  1. added
    bug
    agent-authored
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions