File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
packages/connect-react/src Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -86,19 +86,19 @@ export const FormContextProvider = <T extends ConfigurableProps>({
8686 // Resolve user ID with deprecation warning
8787 const {
8888 resolvedId : resolvedExternalUserId , warningType,
89- } = useMemo ( ( ) =>
90- resolveUserId ( externalUserId , userId ) ,
91- [
89+ } = useMemo ( ( ) => resolveUserId ( externalUserId , userId ) , [
9290 externalUserId ,
9391 userId ,
9492 ] ) ;
9593
9694 // Show deprecation warnings in useEffect to avoid render side effects
9795 useEffect ( ( ) => {
98- if ( warningType === "both" ) {
99- console . warn ( "[connect-react] Both externalUserId and userId provided. Using externalUserId. Please remove userId to avoid this warning." ) ;
100- } else if ( warningType === "deprecated" ) {
101- console . warn ( "[connect-react] userId is deprecated. Please use externalUserId instead." ) ;
96+ if ( process . env . NODE_ENV !== "production" ) {
97+ if ( warningType === "both" ) {
98+ console . warn ( "[connect-react] Both externalUserId and userId provided. Using externalUserId. Please remove userId to avoid this warning." ) ;
99+ } else if ( warningType === "deprecated" ) {
100+ console . warn ( "[connect-react] userId is deprecated. Please use externalUserId instead." ) ;
101+ }
102102 }
103103 } , [
104104 warningType ,
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ export const resolveUserId = (
66 externalUserId ?: string ,
77 userId ?: string ,
88) : { resolvedId : string ; warningType ?: "both" | "deprecated" } => {
9- if ( externalUserId ) {
10- if ( userId ) {
9+ if ( externalUserId !== undefined && externalUserId !== "" ) {
10+ if ( userId !== undefined && userId !== "" ) {
1111 return {
1212 resolvedId : externalUserId ,
1313 warningType : "both" ,
@@ -18,7 +18,7 @@ export const resolveUserId = (
1818 } ;
1919 }
2020
21- if ( userId ) {
21+ if ( userId !== undefined && userId !== "" ) {
2222 return {
2323 resolvedId : userId ,
2424 warningType : "deprecated" ,
You can’t perform that action at this time.
0 commit comments