Can't Edit Topic with Poll, Bug Occurs?

I am getting a bug when trying to edit a topic post with a poll in it.

To replicate

  1. Make a new topic with a poll in it, like the one below
[poll name=pollA type=regular results=on_close public=true chartType=bar]
* Option
[/poll]
  1. Publish the topic and vote in the poll

  2. Refresh the page

  3. Edit the topic post.

I get this error in my console and the page hangs, no composer preview is generated, etc.

I think this NaN% could be related:


I hope I can replicate it on here, trying now.

  • Option
0 voters

Sadly, it seems I canā€™t replicate it on meta here. I did do a fresh update before testing on my instance, currently running 3.4.0.beta1-dev ( a3d61ba1c4)

Not sure if it matters but I have poll edit window mins set to 90 mins

3 Likes

Tested with version 3.4.0.beta1-dev and it works fine

Tested with poll edit windows mins set to 90

[poll name=pollA type=regular results=on_close public=true chartType=bar]
* Option
[/poll]

Voted in poll and then edited topic

Have you tried in safe mode?

http://discourse.example.com/safe-mode

I tried in safe mode with no themes (and replicated the issue) but unfortunately I canā€™t try with no plugins because the polling is a plugin

1 Like

Ah got it to happen on mineā€¦

Recap

Version

3.4.0.beta1-dev

Setting

Tested with poll edit windows mins set to 90

Poll

[poll name=pollA type=regular results=on_close public=true chartType=bar]
* Option
[/poll]

Error

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0b05a21ff916fbd0f86b5172a2817610')

Possibly related to

name=pollA 

@piffy Try this

[poll type=regular results=always public=true chartType=bar]
* Option
[/poll]

Edit: This seems to work fine so name=pollA seems to be a problem

Thanks for the further investigation. It seems itā€™s not the poll name that is the problem but actually the on_close

I forgot to add a close time to the poll in the OP (and now itā€™s been >5 minutes so I canā€™t edit it anymore :slight_smile: ). But on my instance:

This one causes a problem

[poll name=pollB type=regular results=on_close public=true chartType=bar close=2024-08-15T19:00:00.000Z]
* Option
[/poll]

This one seems to have no issue

[poll name=pollC type=regular results=always public=true chartType=bar]
* Option
[/poll]
2 Likes

Thanks for the report. Iā€™ll take a look.

3 Likes

Tested this

[poll name=pollB type=regular results=on_close public=true chartType=bar close=2024-08-15T19:00:00.000Z]
* Option
[/poll]

Works fine for me, no errors

See Can't Edit Topic with Poll, Bug Occurs? - #4 by Vaping_Community

I believe Iā€™ve identified the issue.

I believe correctly, when the poll is set to ā€œresults ON_CLOSEā€, vote numbers for each option are only streamed to the browser when the vote is Closed.

The issue is that when you refresh the page, the default view is results, which for this type of poll should NOT happen.

The Results view should not be possible to see until closure, even for the Author.

So the fix here is making sure the default view (for polls that have results on close) is the voting view until the Poll is Closed.

Iā€™ll prepare a PR.

4 Likes

PR raised here:

4 Likes

This has been merged, please confirm all is now resolved.

1 Like

This topic was automatically closed after 3 days. New replies are no longer allowed.