-
Notifications
You must be signed in to change notification settings - Fork 178
feat: component graph node name toogle #797
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
Conversation
@@ -99,9 +102,12 @@ const data = computed<Data>(() => { | |||
const isGrayedOut = searchDebounced.value && !rel.id.toLowerCase().includes(searchDebounced.value.toLowerCase()) | |||
const label = path.split('/').splice(-1)[0].replace(/\.\w+$/, '') |
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.
Shouldn't we use an utility function to infer a better name from the path, instead of relying on the selected state?
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.
That's interesting! But I'm not sure what the best approach is to extract the component name from the path.
Could you review my function if I implement it like this?
function getComponentName(path: string) {
const splitPath = path.split('/');
const lastChunkPath = splitPath.splice(-1)[0].replace(/\.\w+$/, '');
if (lastChunkPath === 'index') {
return splitPath.splice(-2)[0].replace(/\.\w+$/, '')
}
return lastChunkPath
}
If my code is incorrect or if you have a better approach, please let me know.
@antfu I pushed my updated version using the However, Iβm not sure if this approach aligns with your preference. |
I am not sure if I understand why we need to update the label name on select and reset back. Shouldn't we just give the correct name at the first place? I updated the PR to change that. Hope that makes sense to you (let me know if not). Thanks for the PR |
@antfu Thank you for reviewing my code.
I was just following the approach to create the toggle feature as described in the issue #694. Would you like me to create a new PR to implement this approach? |
I already change that in |
Thank you so much. |
π Linked issue
resolves #694
β Type of change
π Description
I added the PascalCase component name to the selectedLabel field in extra as the selected display label, while keeping label as the current node label.
Next, I implemented DataSet for nodes, allowing node labels to be updated by their ID.
I also updated the playground to reproduce this enhancement. If this update is unnecessary, Iβm happy to remove it as needed.
Screenshot
Screen.Recording.2568-02-27.at.01.01.43.mov
If you have any feedback or suggestions, please donβt hesitate to let me know.