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
{{ message }}
Repository navigation
[Bug] [DataStudio] The "create root directory" modal pops up again after the creation succeeds #4576
I had searched in the issues and found no similar issues.
What happened
In DataStudio (数据开发), when creating a root directory, after entering the name and clicking OK, the directory is created successfully and the project tree refreshes — but the create root directory modal immediately pops up again. If the user clicks OK once more, it tries to create a duplicate directory and fails with a duplicate-name error.
The same code is still present in current master.
Root cause — dinky-web/src/pages/DataStudio/Toolbar/Project/index.tsx:
The effect that handles actionType has the dependency array [actionType, params, data, treeData], and its PROJECT_CREATE_ROOT_DIR branch only calls setOpenCreateRootDir(true) without resetting the action afterwards:
After a successful creation, handleCreateRootDirSubmit calls refresh(). When the refreshed tree data arrives, data changes and the effect re-runs. Since actionType is still PROJECT_CREATE_ROOT_DIR, setOpenCreateRootDir(true) executes again and the modal reopens.
For comparison, Toolbar/Catalog/index.tsx resets the action after handling it:
After the root directory is created successfully, the modal should close and stay closed; the refreshed tree simply shows the new directory.
How to reproduce
Open the web UI → DataStudio (数据开发)
Click the 新建目录 (create root directory) button at the top-left of the project panel
Enter a name and click OK / 确认
The modal closes and the tree refreshes, then the same create-root-directory modal opens again
(Optional) Click OK again → the backend rejects it with a duplicate-name error
Anything else
Frequency: happens every time when creating a root directory.
Possible fix: reset the action after handling it (updateAction({ actionType: null, params: null })), or move the action handling into an effect keyed only on [actionType].
Activity