-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:网页面板下,右侧pin的面板拖拽事件丢失问题 || fix: Under the web page panel, the panel drag event on the right pin is lost #146
base: master
Are you sure you want to change the base?
Conversation
}); | ||
|
||
export const dragActions = globalSlice.actions; | ||
export const dragReducer = globalSlice.reducer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its looks like should not create a new slice and should merge into uiSlice
.
} | ||
|
||
const initialState: DragState = { | ||
isDraging: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its should be isDragging
@@ -0,0 +1,27 @@ | |||
import { useAppSelector ,useAppDispatch} from './useAppSelector'; | |||
import {dragActions} from '../slices/drag' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why your code not auto format? did you skip github hooks manual?
@@ -15,25 +17,27 @@ interface WebviewProps { | |||
export const Webview: React.FC<WebviewProps> = (props) => { | |||
const ref = useRef<HTMLIFrameElement>(null); | |||
const [spinning, setSpinning] = useState(true); | |||
|
|||
const status = useDragstatus() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An important problem is component Webview
is a pure component and should not dependency with redux. redux has a scope in main route, the other route not use redux anywhere and not need it.
This code will restrict this component must be render under redux context.
My suggestion is change pin logic, and overlay a translucent div on both sides of the drag bar. To make sure drag event not send into iframe
* 更新 | ||
*/ | ||
const updateStatus= useMemoizedFn((status: boolean) => { | ||
setStatus(status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can direct call dispatch(dragActions.setDragStatus(status))
. and suggest replace useMemoizedFn
with useEvent
undefined
null