Plots2: Can't publish a newResearch Note

Created on 27 Jan 2019  ·  18Comments  ·  Source: publiclab/plots2

Steps to reproduce:

Navigate to https://publiclab.org/post and after filling in the required fields, hit publish.

Expected behavior:

The research note is published.

Actual behavior:

Nothing happens. Attaching the console errors here.

screenshot 2019-01-27 at 19 18 20

bug inspection

Most helpful comment

Aha! I believe the error is related to not loading the Google geocoding library. Not sure why it's not loading but it is a dependency of the new Editor map module.

I tracked it to here, but I think that's just the symptom of the true cause: https://github.com/publiclab/plots2/blob/87db5642c4f434e9eaaa3478f79d2584916c6d09/app/views/editor/questionRich.html.erb#L172

OK, it seems to relate to how we don't include the Google API here:

<!-- required for MapModule -->
  | <!-- <script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyDWgc7p4WWFsO3y0MTe50vF4l4NUPcPuwE"></script> -->

OK, i think it's in /app/views/editor/rich.html.erb but not active. It's in the footer but not being activated early enough as @sagarpreet-chadha has noted. Trying to move it to the top.

All 18 comments

Hi @edieblu, thanks for reporting the issue with such descriptive steps.

@jywarren I think, PublicLab.editor integration is not properly working as the editor instance isn't created resulting in "cannot read property titleModule of undefined".

Thanks!

Uh oh, maybe we can ask @rexagod or others who've been working on the
editor recently if there have been any changes that could've caused this?

On Sun, Jan 27, 2019, 5:04 PM Gaurav Sachdeva <[email protected]
wrote:

Hi @edieblu https://github.com/edieblu, thanks for reporting the issue
with such descriptive steps.

@jywarren https://github.com/jywarren I think, PublicLab.editor
integration is not properly working as the editor instance isn't created
resulting in "cannot read property titleModule of undefined".

Thanks!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/4714#issuecomment-457949450,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJ-G2KtnicWGXOj_shVgoTg4Sqsjkks5vHgZEgaJpZM4aU48i
.

Can we get a line number for the editor error, I wonder if it's due to the changes to the "steps left" code?

Hmmm maybe not as that was only 24 h ago...

Fix Publish button disabled state
Closed by jywarren about 24 hours ago

https://github.com/publiclab/PublicLab.Editor/pull/252

And perhaps we can try to replicate it on stable.publiclab.org...

Hi @edieblu, do you think you could share the post text in a fist at https://gist.github.com and paste the link here? Sorry for all the trouble, we're just trying to track this down. Thanks!

@sagarpreet-chadha is there a possibility that this could be related to needing additional dependencies for the new map module? See above errors... I'm trying to reproduce.

Aha! I believe the error is related to not loading the Google geocoding library. Not sure why it's not loading but it is a dependency of the new Editor map module.

I tracked it to here, but I think that's just the symptom of the true cause: https://github.com/publiclab/plots2/blob/87db5642c4f434e9eaaa3478f79d2584916c6d09/app/views/editor/questionRich.html.erb#L172

Aha! I believe the error is related to not loading the Google geocoding library. Not sure why it's not loading but it is a dependency of the new Editor map module.

I tracked it to here, but I think that's just the symptom of the true cause: https://github.com/publiclab/plots2/blob/87db5642c4f434e9eaaa3478f79d2584916c6d09/app/views/editor/questionRich.html.erb#L172

OK, it seems to relate to how we don't include the Google API here:

<!-- required for MapModule -->
  | <!-- <script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyDWgc7p4WWFsO3y0MTe50vF4l4NUPcPuwE"></script> -->

OK, i think it's in /app/views/editor/rich.html.erb but not active. It's in the footer but not being activated early enough as @sagarpreet-chadha has noted. Trying to move it to the top.

That would explain why none of the footer buttons seem to work.

This was saved in a db-backed feature -- we have features in both header and footer so i just moved it. Will do same on stable and check there too.

I did have a hunch about the mapModule causing this since that was the last major addition to the repo and the logs too indicated the same. "google" is not defined was a straight indication to the scripts not being loaded. :thinking:

OK it's live on production and @edieblue you should be able to post now although i haven't confirmed this myself.

@jywarren It's working now. :+1:

Great. Closing this! Also noting that:

  1. we should try to do our testing on https://stable.publiclab.org when possible
  2. this was a tough one to catch because we are trying to keep the Google Maps API key configurable and not git-tracked, so it didn't show up in development mode.
  3. i was thinking of how we could test for this bug in the future but as it's due to a dependency i think i'm less worried about this now.

Finally, if anyone has thoughts on running tests of some kind i haven't thought of that /could/ guard against this in the future, i'm all ears!!!

Works great @jywarren, thanks for the fix! 👍

Apologies for late reply 😄 !

I had faced the same error in console when i was working on mapmodule integration , referencing that comment here for future tracking : https://github.com/publiclab/plots2/pull/4608#discussion_r248002791

Instead of adding the if condition in _footer.html.erb , can i add that if condition here ?
When used in footer , the Google API gave - google not found error and when adding an explicit script tag to the page - it gave - 'google api used two times , may give unexpected error' .

So i finally removed the google API script everywhere AND kept it here . What do you think ?

Thanks and yes I remember you'd warned a bit of this issue so apologies for
not testing it out more thoroughly!

On Tue, Jan 29, 2019, 8:12 AM Sagarpreet Chadha <[email protected]
wrote:

Apologies for late reply 😄 !

I had faced the same error in console when i was working on mapmodule
integration , referencing that comment here for future tracking : #4608
(comment)
https://github.com/publiclab/plots2/pull/4608#discussion_r248002791

Instead of adding the if condition in _footer.html.erb , can i add that if
condition here ?
When used in footer , the Google API gave - google not found error and
when adding an explicit script tag to the page - it gave - 'google api used
two times , may give unexpected error' .

So i finally removed the google API script everywhere AND kept it here .
What do you think ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/4714#issuecomment-458501605,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJzgdXsPOf2oFqPKghYyd7LjHUfnuks5vICx-gaJpZM4aU48i
.

Was this page helpful?
0 / 5 - 0 ratings