fix: application crash by clipping the recursion with a limit of 10 #1101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This fixes the issue of website crashing due to too many recursions.
BUT
Even if we put a recursion limit of 10 to the function like this -> https://github.com/catosaurusrex2003/asyncapi-react/blob/9b73e41b7a644992851068d6cf327a5775eb7884/library/src/helpers/schema.ts#L521-L569
We will still have the recursive part rendering 10 times like this
The best approach would be to create an
ErrorBoundary
( using this ) on the whole application inlibrary/src/containers/AsyncApi/Layout.tsx
.So we can throw error indiscriminately instead of a empty object in
jsonFieldToSchema
function.We can render the error and make the app recoverable.
Let me know if my current approach is fine or should i modify my PR with the approach with an
ErrorBoundary
.Related issue(s)
#1100