Automattic / crowdsignal-forms

Gutenberg blocks for Crowdsignal
GNU General Public License v2.0
13 stars 9 forks source link

Front end poll display on window load #250

Closed mae829 closed 3 months ago

mae829 commented 1 year ago

Noticed there's a delay in the polls loading on sites that have longer load times (e.g. sites with ads that will take time to return and delays the full page load time).

Found the reason for this in the source code and here in the repo: https://github.com/Automattic/crowdsignal-forms/blob/a9bed7b2cb4d1556fecc5890b0d5491502097196/client/lib/mutation-observer/index.js#L12

I did a quick swap for document.addEventListener ( 'DOMContentLoaded' in the source code for testing and the polls loaded faster on the FE and didn't notice any issues with loading or interactivity. If the swap is possible it would greatly help with loading the polls without being dependent of 3rd party elements delaying load time.

I'd do a pull request with the suggestion but I didn't see a contribution guide file?