Skip to content
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

fix: move ++ opertator to the front & cleanup useEffect #336

Closed
wants to merge 2 commits into from

Conversation

MitchWijt
Copy link

This PR fixes the SVG renderer.

Previous the listener id index was being incremented by doing id++. However this returns the unincremented result. Meaning if id = 0. id++ will return 0. The id never got incremented, causing the function to crash.

Second bug fix is cleaning up the useEffect function in the Voyager component, this was causing errors.

@MitchWijt
Copy link
Author

@IvanGoncharov Could you have a look at this whenever you have the time please? It will fix a bug people are having currently rendering graphs

@ravar17
Copy link

ravar17 commented Jul 26, 2023

@IvanGoncharov , Could you please have a look and approve..

cc @MitchWijt

@ravar17
Copy link

ravar17 commented Jul 27, 2023

I am so sorry, but we are in the tight deadline to achieve the voyager feature into out backstage developer portal. could you please approve and merge this PR, so that we can TEST. Thanks

@IvanGoncharov , Could you please have a look and approve..

cc @MitchWijt

@IvanGoncharov
Copy link
Member

Previous the listener id index was being incremented by doing id++. However this returns the unincremented result. Meaning if id = 0. id++ will return 0. The id never got incremented, causing the function to crash.

@MitchWijt I don't get what the problem is here, can you please explain with more details?
id is incrementing and everything is working in my case if you add console.log('id', id); you will see that it gets a new value each time.

if(isMounted) {
setIntrospectionData(data);
setSelected({ typeID: null, edgeID: null });
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you please explain what you are fixing here?

@IvanGoncharov
Copy link
Member

@MitchWijt This issue is already fixed here:
https://github.com/graphql-kit/graphql-voyager/pull/324/files
Can you please try this PR?

@MitchWijt
Copy link
Author

MitchWijt commented Jul 28, 2023

@IvanGoncharov The problem comes forth over here: backstage/backstage#18736

The isMounted fixes the error Can't perform a React state update on an unmounted component. On every render of the component I was getting this error.

id was not correctly incrementing in my case, causing the listeners array to be invalid, thus rendering of the voyager graph failing. Which you can see in the backstage bug PR

@ravar17
Copy link

ravar17 commented Aug 1, 2023

@IvanGoncharov @MitchWijt
any updates ?

@MitchWijt
Copy link
Author

@IvanGoncharov does the above comment make sense to you?

@MitchWijt
Copy link
Author

@IvanGoncharov Will these changes be published to NPM any time soon?

@IvanGoncharov
Copy link
Member

@MitchWijt I will try to publish something today.
Did you had a chance to test the current main? Is it working for you?

@IvanGoncharov
Copy link
Member

Sign up for free to 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.

3 participants