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

Mobile: CodeMirror: Tests: Ensure full document is parsed, don't rely on timeout #7405

Merged

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

const timeout = 100; // ms
ensureSyntaxTree(editorState, editorState.doc.length, timeout);
}
while (!syntaxTreeAvailable(editorState));
Copy link
Owner

Choose a reason for hiding this comment

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

Could you add a guard against infinite loops please? Because if it happens it will be hard to find where. Maybe count the loops and after a thousand or something throw an exception.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It might make more sense to just have a large timeout (e.g. 3 seconds), then throw if !syntaxTreeAvailable — this should be equivalent to the above loop with a guard.

Copy link
Owner

Choose a reason for hiding this comment

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

Indeed that's a better solution, thanks for the update!

@laurent22 laurent22 merged commit 4860253 into laurent22:dev Dec 7, 2022
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.

None yet

2 participants