Skip to content

feat: Added ui feedback when adding type in typesync - #512

Open
unniznd wants to merge 5 commits into
graphprotocol:mainfrom
unniznd:feat_ui_feedback_for_adding_type
Open

feat: Added ui feedback when adding type in typesync#512
unniznd wants to merge 5 commits into
graphprotocol:mainfrom
unniznd:feat_ui_feedback_for_adding_type

Conversation

@unniznd

Copy link
Copy Markdown
Contributor

UI Feedback when you added a new type from the left panel
Closes#498

@cmwhitedcmwhited left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate you taking this task on!
Few things:

  1. make sure to format and lint your code
  2. I am not sure the typeRefs map and useEffect is the best way to scroll the newly added type into view. could just add the scroll into view in the KnowledgeGraphBrowser.typeSelected instead. much less state to manage and the useEffect has me really worried

@unniznd

Copy link
Copy Markdown
ContributorAuthor

@cmwhited thank you for your feedback. I will work on it.

@unniznd

unniznd commented Aug 26, 2025

Copy link
Copy Markdown
ContributorAuthor

@cmwhited
I have removed the usage of useEffect and added in KnowledgeGraphBrowser.typeSelected the scrolling logic. Can you help me with linting the code? The pnpm lint:fix is giving me errors.

@cmwhited

Copy link
Copy Markdown
Collaborator

@cmwhited I have removed the usage of useEffect and added in KnowledgeGraphBrowser.typeSelected the scrolling logic. Can you help me with linting the code? The pnpm lint:fix is giving me errors.

what errors is it giving you?

@unniznd

Copy link
Copy Markdown
ContributorAuthor

I have fixed the issue in linting. I was having a package installation issue. I have updated the code. Can you review and give some feedback @cmwhited

@unniznd
unniznd requested a review from cmwhitedAugust 27, 2025 16:14
// Create a ref to store DOM references for each type
const typeRefs = useRef<Map<number, HTMLDivElement>>(new Map());
// State to track the index of the newly added type
const [_newTypeIndex, setNewTypeIndex] = useState<number | null>(null);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we aren't reading the state variable here: _newTypeIndex, which I am assuming we are not because you prepended it with an underscore, then why do we need to set the state at all? It isn't being used, is it?

});

// Create a ref to store DOM references for each type
const typeRefs = useRef<Map<number, HTMLDivElement>>(new Map());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still does not feel like the right answer to me. Especially not the way it is being set

@unniznd

Copy link
Copy Markdown
ContributorAuthor

@cmwhited, I have updated the code. Can you review and give some feedback?

@unniznd
unniznd requested a review from cmwhitedOctober 30, 2025 13:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(TypeSync) UI Feedback when you add a new type from the left panel

2 participants

@unniznd@cmwhited