Skip to content

Conversation

@VladimirZaets
Copy link
Contributor

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@AmyJZhao AmyJZhao requested a review from Copilot September 30, 2025 07:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a frames communication prototype that introduces extensible state management capabilities for cross-frame communication between host and guest components in the UIX framework. The implementation provides a centralized state management system that allows data synchronization between different UI frames.

Key changes:

  • Adds extensible state management system with store manager and pub/sub mechanism
  • Implements React hooks and components for both host and guest environments
  • Creates new uix-guest-react package for React-specific guest functionality
  • Establishes communication channels between UI frames for state broadcasting

Reviewed Changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
packages/uix-host/src/port.ts Adds uiFrames tracking array to Port class
packages/uix-host-react/src/hooks/useExtensibilityState.tsx Implements host-side state management hook
packages/uix-host-react/src/components/ExtensibleState/* Creates extensible state provider components
packages/uix-host-react/src/components/GuestUIFrame.tsx Registers UI frames for communication
packages/uix-guest/src/guest-ui.ts Adds broadcast capabilities to guest UI
packages/uix-guest-react/* Complete new package for React guest components
packages/uix-core/src/store/* Core state management infrastructure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -0,0 +1,8 @@
import { useExtensibilityState } from "./useExtensibilityState";

export const useHostExtensibilityState = (
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name contains a typo: 'useHostExtensibityState' should be 'useHostExtensibilityState' (missing 'il' in 'Extensibility').

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,8 @@
import { useExtensibilityState } from "./useExtensibilityState";

export const useExtensionExtensibityState = (
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name contains a typo: 'useExtensionExtensibityState' should be 'useExtensionExtensibilityState' (missing 'il' in 'Extensibility').

Suggested change
export const useExtensionExtensibityState = (
export const useExtensionExtensibilityState = (

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
export * from "./useHostExtensibityState.js";
export * from "./useExtensionExtensibityState.js";
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Export paths contain typos: 'ExtensibityState' should be 'ExtensibilityState' in both file references (missing 'il' in 'Extensibility').

Suggested change
export * from "./useHostExtensibityState.js";
export * from "./useExtensionExtensibityState.js";
export * from "./useHostExtensibilityState.js";
export * from "./useExtensionExtensibilityState.js";

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
This is the `@adobe/uix-host-react` package alone. See [/README.md](../../README.md) for details.
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README incorrectly refers to '@adobe/uix-host-react' but this is the uix-guest-react package. Should be '@adobe/uix-guest-react'.

Suggested change
This is the `@adobe/uix-host-react` package alone. See [/README.md](../../README.md) for details.
This is the `@adobe/uix-guest-react` package alone. See [/README.md](../../README.md) for details.

Copilot uses AI. Check for mistakes.
export const ExtensibleStateProvider = ({
children,
}: PropsWithChildren<unknown>) => {
const [storeManager, setStoreManager] = useState(null);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using null as initial state is not type-safe. Consider using useState<ExtensibleStoreManagerInterface | null>(null) or a more appropriate initial value to maintain type safety.

Suggested change
const [storeManager, setStoreManager] = useState(null);
const [storeManager, setStoreManager] = useState<ExtensibleStoreManager | null>(null);

Copilot uses AI. Check for mistakes.
const [connection, setConnection] = useState(
undefined as GuestUI<VirtualApi>
);
const [storeManager, setStoreManager] = useState(null);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using null as initial state is not type-safe. Consider using useState<ExtensibleStoreManagerInterface | null>(null) or a more appropriate initial value to maintain type safety.

Suggested change
const [storeManager, setStoreManager] = useState(null);
const [storeManager, setStoreManager] = useState<ExtensibleStoreManager | null>(null);

Copilot uses AI. Check for mistakes.
});
setState(def);
}
}, [storeManager]);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useEffect dependency array is missing key and defaultState dependencies. This could cause the effect to not re-run when these values change, potentially leading to stale closures or incorrect behavior.

Suggested change
}, [storeManager]);
}, [storeManager, key, defaultState]);

Copilot uses AI. Check for mistakes.
setState(value);
}
})();
}, [connection]);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useEffect dependency array is missing key, defaultState, scope, and storeManager dependencies. This could cause the effect to not re-run when these values change, potentially leading to stale closures or incorrect behavior.

Suggested change
}, [connection]);
}, [connection, key, defaultState, scope, storeManager]);

Copilot uses AI. Check for mistakes.
});
setState(def);
}
}, [storeManager]);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useCallback dependency array is missing key dependency. This could cause the callback to use stale values of key if it changes.

Suggested change
}, [storeManager]);
}, [storeManager, key]);

Copilot uses AI. Check for mistakes.
setState(value);
}
})();
}, [connection]);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useCallback dependency array is missing key and scope dependencies. This could cause the callback to use stale values if these change.

Copilot uses AI. Check for mistakes.
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.

1 participant