mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: debounce causes save cell data fail
This commit is contained in:
parent
4856a024a2
commit
3e4e8679ce
@ -111,7 +111,7 @@ class SelectOptionCellEditorBloc
|
|||||||
void _loadOptions() {
|
void _loadOptions() {
|
||||||
_delayOperation?.cancel();
|
_delayOperation?.cancel();
|
||||||
_delayOperation = Timer(const Duration(milliseconds: 10), () {
|
_delayOperation = Timer(const Duration(milliseconds: 10), () {
|
||||||
_selectOptionService.getOpitonContext().then((result) {
|
_selectOptionService.getOptionContext().then((result) {
|
||||||
if (isClosed) {
|
if (isClosed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class SelectOptionService {
|
|||||||
return GridEventUpdateSelectOption(payload).send();
|
return GridEventUpdateSelectOption(payload).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<SelectOptionCellDataPB, FlowyError>> getOpitonContext() {
|
Future<Either<SelectOptionCellDataPB, FlowyError>> getOptionContext() {
|
||||||
final payload = GridCellIdPB.create()
|
final payload = GridCellIdPB.create()
|
||||||
..gridId = gridId
|
..gridId = gridId
|
||||||
..fieldId = fieldId
|
..fieldId = fieldId
|
||||||
|
@ -65,6 +65,8 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
|
_delayOperation = null;
|
||||||
|
_cellBloc.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,15 +74,10 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
|
|||||||
Future<void> focusChanged() async {
|
Future<void> focusChanged() async {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
_delayOperation?.cancel();
|
_delayOperation?.cancel();
|
||||||
_delayOperation = Timer(const Duration(milliseconds: 300), () {
|
_delayOperation = Timer(const Duration(milliseconds: 30), () {
|
||||||
if (_cellBloc.isClosed == false &&
|
if (_cellBloc.isClosed == false &&
|
||||||
_controller.text != contentFromState(_cellBloc.state)) {
|
_controller.text != contentFromState(_cellBloc.state)) {
|
||||||
_cellBloc.add(NumberCellEvent.updateCell(_controller.text));
|
_cellBloc.add(NumberCellEvent.updateCell(_controller.text));
|
||||||
|
|
||||||
if (!mounted) {
|
|
||||||
_delayOperation = null;
|
|
||||||
_cellBloc.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class _GridTextCellState extends GridFocusNodeCellState<GridTextCell> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
_delayOperation?.cancel();
|
_delayOperation = null;
|
||||||
_cellBloc.close();
|
_cellBloc.close();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ class _GridTextCellState extends GridFocusNodeCellState<GridTextCell> {
|
|||||||
Future<void> focusChanged() async {
|
Future<void> focusChanged() async {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
_delayOperation?.cancel();
|
_delayOperation?.cancel();
|
||||||
_delayOperation = Timer(const Duration(milliseconds: 300), () {
|
_delayOperation = Timer(const Duration(milliseconds: 30), () {
|
||||||
if (_cellBloc.isClosed == false &&
|
if (_cellBloc.isClosed == false &&
|
||||||
_controller.text != _cellBloc.state.content) {
|
_controller.text != _cellBloc.state.content) {
|
||||||
_cellBloc.add(TextCellEvent.updateText(_controller.text));
|
_cellBloc.add(TextCellEvent.updateText(_controller.text));
|
||||||
|
Loading…
Reference in New Issue
Block a user