fix: preserve Fast Refresh component boundaries
This commit is contained in:
@@ -210,7 +210,7 @@ const ProviderAttachmentsContext = createContext<AttachmentsContext | null>(
|
||||
null
|
||||
);
|
||||
|
||||
export const usePromptInputController = () => {
|
||||
const usePromptInputController = () => {
|
||||
const ctx = useContext(PromptInputController);
|
||||
if (!ctx) {
|
||||
throw new Error(
|
||||
@@ -224,7 +224,7 @@ export const usePromptInputController = () => {
|
||||
const useOptionalPromptInputController = () =>
|
||||
useContext(PromptInputController);
|
||||
|
||||
export const useProviderAttachments = () => {
|
||||
const useProviderAttachments = () => {
|
||||
const ctx = useContext(ProviderAttachmentsContext);
|
||||
if (!ctx) {
|
||||
throw new Error(
|
||||
@@ -371,7 +371,7 @@ export const PromptInputProvider = ({
|
||||
|
||||
const LocalAttachmentsContext = createContext<AttachmentsContext | null>(null);
|
||||
|
||||
export const usePromptInputAttachments = () => {
|
||||
const usePromptInputAttachments = () => {
|
||||
// Prefer local context (inside PromptInput) as it has validation, fall back to provider
|
||||
const provider = useOptionalProviderAttachments();
|
||||
const local = useContext(LocalAttachmentsContext);
|
||||
@@ -395,10 +395,10 @@ export interface ReferencedSourcesContext {
|
||||
clear: () => void;
|
||||
}
|
||||
|
||||
export const LocalReferencedSourcesContext =
|
||||
const LocalReferencedSourcesContext =
|
||||
createContext<ReferencedSourcesContext | null>(null);
|
||||
|
||||
export const usePromptInputReferencedSources = () => {
|
||||
const usePromptInputReferencedSources = () => {
|
||||
const ctx = useContext(LocalReferencedSourcesContext);
|
||||
if (!ctx) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user