Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: update RectPopup to use useContext and adjust ESLint rules (#4926)

白熱b5d8a8abb5df
diff --git a/common/shared/eslint/index.js b/common/shared/eslint/index.js
index c5c2f0b9db..ca7d583b1e 100644
--- a/common/shared/eslint/index.js
+++ b/common/shared/eslint/index.js
@@ -95,6 +95,7 @@ exports.baseRules = {
'react/no-forward-ref': 'off',
'react/no-context-provider': 'off',
'react-dom/no-render': 'off',
+ 'react/no-use-context': 'off',
// TODO: debatable rules
'react/no-duplicate-key': 'warn',
diff --git a/packages/ui/src/views/components/popup/RectPopup.tsx b/packages/ui/src/views/components/popup/RectPopup.tsx
index b7678a851f..ad85f33c16 100644
--- a/packages/ui/src/views/components/popup/RectPopup.tsx
+++ b/packages/ui/src/views/components/popup/RectPopup.tsx
@@ -20,7 +20,7 @@ import type { Observable } from 'rxjs';
import type { IUniverUIConfig } from '../../../controllers/config.schema';
import { IConfigService } from '@univerjs/core';
import { useDependency } from '@wendellhu/redi/react-bindings';
-import React, { createContext, use, useEffect, useRef } from 'react';
+import React, { createContext, useContext, useEffect, useRef } from 'react';
import { createPortal } from 'react-dom';
import { useEvent } from '../../../components/hooks/event';
import { UI_PLUGIN_CONFIG_KEY } from '../../../controllers/config.schema';
@@ -249,6 +249,6 @@ function RectPopup(props: IRectPopupProps) {
RectPopup.calcPopupPosition = calcPopupPosition;
-RectPopup.useContext = () => use(RectPopupContext);
+RectPopup.useContext = () => useContext(RectPopupContext);
export { RectPopup };