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

Post Preview recursion returns undefined #1

Open
Xyrai opened this issue Nov 27, 2023 · 1 comment
Open

Post Preview recursion returns undefined #1

Xyrai opened this issue Nov 27, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Xyrai
Copy link

Xyrai commented Nov 27, 2023

Hey there! Not sure if you are still maintaining this package, but in case anyone comes across this. There are certain cases in which the postPreview() recursion returns undefined as a value. To prevent this from happening I recommend putting an additional empty check in case this happens at:

nullSource.innerHTML = currentSum + postPreview(elements[i], remainingLength);

My suggested fix would be the following:

const remainingLength = length - additions.length - emptyLength - currentSum.length;
const preview = postPreview(elements[i], remainingLength);
nullSource.innerHTML = currentSum + (preview || '');
return additions + nullSource.outerHTML;
@hosseini44444
Copy link
Owner

Hey @Xyrai
Apologies for the delayed response.
Thanks for bringing up the issue.
It would be great if you could provide me with an example of the bug.
Please feel free to contribute directly by fixing the issue and submitting a PR.

@hosseini44444 hosseini44444 added the bug Something isn't working label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants