react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

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

Open Copilot opened this issue 7 months ago • 4 comments

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 avatar Jun 11 '25 09:06 Copilot

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

anupriya13 avatar Jun 11 '25 09:06 anupriya13

@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 avatar Jun 11 '25 09:06 Copilot

/azp run

anupriya13 avatar Jun 11 '25 09:06 anupriya13

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Jun 11 '25 09:06 azure-pipelines[bot]

@copilot Completely remove the ensureXAMLDialect() function and its functionality.

jonthysell avatar Jul 01 '25 20:07 jonthysell

@copilot Completely remove the ensureXAMLDialect() function and its functionality.

I've completely removed the ensureXAMLDialect() function and all its functionality as requested. This includes:

  • Removed the main function and all supporting methods
  • Removed the function call from the autolink process
  • Removed all related tests and test infrastructure
  • Cleaned up unused imports

The changes resulted in a net reduction of 260+ lines of code. The autolink functionality now focuses purely on generating autolink files for native modules without any XAML dialect management.

Commit: 7ce01ee

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.116/linux64/chrome-linux64.zip
    • Triggering command: /usr/local/bin/node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar Jul 01 '25 21:07 Copilot

/azp run PR

jonthysell avatar Jul 02 '25 21:07 jonthysell

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Jul 02 '25 21:07 azure-pipelines[bot]