Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: workspace name conflicts (#7992)

Lucasc78564ea79f7
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart
index c8b8065ec6..6ba7c9d82f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart
@@ -241,7 +241,9 @@ class _WorkspaceNameSetting extends StatefulWidget {
class _WorkspaceNameSettingState extends State<_WorkspaceNameSetting> {
final TextEditingController workspaceNameController = TextEditingController();
final focusNode = FocusNode();
- Timer? _debounce;
+
+ Timer? debounce;
+ bool isSaving = false;
@override
void dispose() {
@@ -254,6 +256,10 @@ class _WorkspaceNameSettingState extends State<_WorkspaceNameSetting> {
Widget build(BuildContext context) {
return BlocConsumer<WorkspaceSettingsBloc, WorkspaceSettingsState>(
listener: (_, state) {
+ if (isSaving) {
+ return;
+ }
+
final newName = state.workspace?.name;
if (newName != null && newName != workspaceNameController.text) {
workspaceNameController.text = newName;
@@ -287,10 +293,15 @@ class _WorkspaceNameSettingState extends State<_WorkspaceNameSetting> {
}
void _debounceSaveName(String name) {
- _debounce?.cancel();
- _debounce = Timer(
+ isSaving = true;
+
+ debounce?.cancel();
+ debounce = Timer(
const Duration(milliseconds: 300),
- () => _saveWorkspaceName(name: name),
+ () {
+ _saveWorkspaceName(name: name);
+ isSaving = false;
+ },
);
}