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

Comment takes 'undefined' after submit a comment #1698

Closed
HZooly opened this issue Jan 31, 2019 · 7 comments
Closed

Comment takes 'undefined' after submit a comment #1698

HZooly opened this issue Jan 31, 2019 · 7 comments
Labels
bug always open for contribution external contributors welcome contribution is welcome!

Comments

@HZooly
Copy link

HZooly commented Jan 31, 2019

Describe the bug
Just after submitting a comment on an post, text area is not blank, but takes undefined as text value.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a post
  2. Submit a comment
  3. Check comment textarea

Expected behavior
Expected to get a blank textarea with placeholder.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Brave 0.58.21 (Chromium 71)
  • Version: Latest online at this date
@aligoren
Copy link
Contributor

aligoren commented Jan 31, 2019

I faced the same issue with CTRL + Enter shortcut.

I'm not quite sure, but it could be a bug related to below function. Maybe newComment doesn't have comment_template property.

https://github.com/thepracticaldev/dev.to/blob/d7665fcc3f7342e1f7de172397227a353b619044/app/assets/javascripts/initializers/initializeCommentsPage.js.erb#L220-L231

@rhymes
Copy link
Contributor

rhymes commented Jan 31, 2019

@aligoren yeah I think is line 225, comment_template is a new feature and if that is undefined you would get undefined as the text instead of an empty string

@aligoren
Copy link
Contributor

@rhymes So, should we check for undefined? For example;

var newComment = {
}

var commentTemplate = newComment.comment_template || ''

In the above example, newComment don't have comment_template. Even doesn't have, will not return undefined.

@rhymes
Copy link
Contributor

rhymes commented Jan 31, 2019

yeah, I'm submitting a fix exactly like that :D

@aligoren
Copy link
Contributor

Do it! I can't do this now because of I'm at work. Thx.

@aspittel
Copy link
Contributor

Thank you so much for catching this @HZooly, @aligoren, and @rhymes!

@aspittel aspittel added the bug always open for contribution label Jan 31, 2019
@aspittel aspittel added the external contributors welcome contribution is welcome! label Jan 31, 2019
@HZooly
Copy link
Author

HZooly commented Jan 31, 2019

Thanks you for fixing this so fast! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug always open for contribution external contributors welcome contribution is welcome!
Projects
None yet
Development

No branches or pull requests

4 participants