You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created an util function that make three callbacks for drag an element. One of them is mouse_down which is created by Callback and binded in yew html macro, another two callbacks are created by Closure, this two callbacks are binded into the body element. This three callbacks are using a state named is_draged, so i created a variable is_draged by Rc<RefCell<bool>>, each of this three callbacks moved a copy of is_dragged into their closure context, the variable is_dragged is changed in callback mouse_down and mouse_up. The issue is that the change of is_dragged made by mouse_down is not synced into mouse_up and mouse_move, i printted the data ptr of is_dragged use Rc::as_ptr, the result showed that the ptr in mouse_down is different with mouse_up and mouse_move, but it is the same between mouse_up and mouse_move. Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
The value of is_dragged should be the same between this three callbacks while it is not.
The ptr (represented the RefCell) should be the same between thie three callback while it is not.
Screenshots
See the step 2.
Environment:
Yew version: [e.g. v0.20, master]
Rust version: [e.g. 1.67.0, nightly]
Target, if relevant: [e.g. wasm32-unknown-emscripten]
Build tool, if relevant: [e.g. wasm-pack, trunk]
OS, if relevant: [e.g. wsl ubuntu22.04]
Browser and version, if relevant: [e.g. Chrome v112]
Questionnaire
I'm interested in fixing this myself but don't know where to start
I would like to fix and I have a solution
I don't have time to fix this right now, but maybe later
The text was updated successfully, but these errors were encountered:
Problem
I have created an util function that make three callbacks for drag an element. One of them is
mouse_down
which is created byCallback
and binded in yew html macro, another two callbacks are created byClosure
, this two callbacks are binded into the body element. This three callbacks are using a state namedis_draged
, so i created a variableis_draged
byRc<RefCell<bool>>
, each of this three callbacks moved a copy of is_dragged into their closure context, the variableis_dragged
is changed in callbackmouse_down
andmouse_up
. The issue is that the change ofis_dragged
made bymouse_down
is not synced intomouse_up
andmouse_move
, i printted the data ptr ofis_dragged
use Rc::as_ptr, the result showed that the ptr inmouse_down
is different withmouse_up
andmouse_move
, but it is the same betweenmouse_up
andmouse_move
.Steps To Reproduce
Steps to reproduce the behavior:
The drag utils
bind mouse_down in html macro
Expected behavior
The value of
is_dragged
should be the same between this three callbacks while it is not.The ptr (represented the RefCell) should be the same between thie three callback while it is not.
Screenshots
See the step 2.
Environment:
master
]nightly
]wasm32-unknown-emscripten
]wasm-pack
,trunk
]Questionnaire
The text was updated successfully, but these errors were encountered: