Skip to content

Deprecate autolink functionality to copy useWinUI3 flags from react-native.config.js into ExperimentalFeatures.props #14761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 11, 2025

Summary

This PR removes the deprecated functionality in ensureXAMLDialect() that allowed useWinUI3 values from react-native.config.js to override values in ExperimentalFeatures.props. This feature was confusing, unnecessary, and causing test failures.

Background

The ensureXAMLDialect() function previously had logic that:

  1. Read useWinUI3 from react-native.config.js
  2. If present, overwrote the corresponding value in ExperimentalFeatures.props
  3. Used the config value instead of the project file value for package configuration

This behavior was problematic because:

  • WinUI3 is no longer supported in Old architecture projects
  • WinUI3 is not optional in New Architecture projects
  • The feature was broken and causing autolink test failures
  • It created confusing behavior where config could silently override project files

Changes Made

Core Logic Changes

  • Simplified ensureXAMLDialect() function in autolinkWindows.ts:
    • Removed useWinUI3FromConfig variable and related logic
    • Removed the entire block (lines 740-755) that overwrote ExperimentalFeatures.props
    • Function now only uses values directly from ExperimentalFeatures.props

Test Updates

  • Removed failing tests in autolink.test.ts:

    • ensureXAMLDialect - useWinUI3=true in react-native.config.js, useWinUI3=false in ExperimentalFeatures.props
    • ensureXAMLDialect - useWinUI3=false in react-native.config.js, useWinUI3=true in ExperimentalFeatures.props
  • Removed broken test in projectConfig.test.ts:

    • The skipped test that was marked as broken due to this issue

Preserved Functionality

  • The useWinUI3 setting in react-native.config.js remains available for other uses (e.g., project generation)
  • Two tests remain that verify the function works correctly when using ExperimentalFeatures.props values directly
  • All other autolink functionality is unchanged

Impact

  • ✅ Resolves test failures mentioned in the issue
  • ✅ Eliminates confusing behavior where config could override project files
  • ✅ Minimal code changes (net reduction of 138 lines)
  • ✅ No breaking changes to public APIs
  • ✅ Maintains backward compatibility for other useWinUI3 usage

Testing

The remaining tests verify that:

  • When useWinUI3 is not specified in config, the function uses ExperimentalFeatures.props values directly
  • The function correctly handles both UseWinUI3=true and UseWinUI3=false in project files
  • Package configuration is updated appropriately based on the project file values

Fixes #14601.

@Copilot Copilot AI changed the title [WIP] Deprecate autolink functionality to copy flags from react-native.config.js into ExperimentalFeature.props. Deprecate autolink functionality to copy useWinUI3 flags from react-native.config.js into ExperimentalFeatures.props Jun 11, 2025
@Copilot Copilot AI requested a review from anupriya13 June 11, 2025 09:12
Copilot finished work on behalf of anupriya13 June 11, 2025 09:12
@anupriya13
Copy link
Contributor

@copilot run yarn change and then commit.
After commit comment here "/azp run" to start the pipelines

Copy link
Author

Copilot AI commented Jun 11, 2025

@copilot run yarn change and then commit.
After commit comment here "/azp run" to start the pipelines

I've run yarn change and committed the change file. The commit 5af8740 adds the required beachball change tracking file for the @react-native-windows/cli package.

Copilot finished work on behalf of anupriya13 June 11, 2025 09:36
@anupriya13
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate autolink functionality to copy flags from react-native.config.js into ExperimentalFeature.props.
2 participants