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

Bug - bookmark toggle throws js error #769

Closed
labradford opened this issue Sep 11, 2019 · 13 comments
Closed

Bug - bookmark toggle throws js error #769

labradford opened this issue Sep 11, 2019 · 13 comments
Labels

Comments

@labradford
Copy link
Contributor

On the bookmark toggle checkbox, you are able to check/uncheck each bookmark box once. When you click a second time, a JS alert appears with an error. Reloading the page allows you to check/uncheck again, but only once for each checkbox.

@labradford labradford added the bug label Sep 11, 2019
@labradford labradford changed the title Bug - bookmark toggle throw js error Bug - bookmark toggle throws js error Sep 11, 2019
@christinach
Copy link
Member

I can't seem to reproduce this error.

@jkeck
Copy link
Contributor

jkeck commented Sep 17, 2019

I think this may be a turbolinks issue. If you go from the home page, click on collections, and try to bookmark, then unbookmark a record, you get an error. If you refresh that same page and bookmark/unbookmark the error does not occur.

@christinach
Copy link
Member

thanks @jkeck I'll check again

@christinach
Copy link
Member

now I see it thanks @jkeck !

@christinach christinach self-assigned this Sep 17, 2019
@christinach
Copy link
Member

A first approach was to remove turbolinks when generating the engine: https://github.com/projectblacklight/arclight/tree/remove-turbolinks. I tested it locally with a local copy of Blacklight and the bookmark check/uncheck was setting the attribute successfully. When I tested a collection item I could still trigger the same error [HTTP/1.1 422 Unprocessable Entity ].
second approach: I put back the turbolinks and added the refreshCSRFTokens function to refresh the tokens when loading turbolinks https://github.com/projectblacklight/arclight/tree/769-refresh-csrftokens. This was successful for the collection level but still wouldn't work for the form in a collection level item.

@christinach christinach removed their assignment Sep 21, 2019
@seanaery
Copy link
Contributor

Looks like this issue is specific to Rails 5.2 and was reported here as a Blacklight issue:
projectblacklight/blacklight#2002

More info here on Penn State's Blacklight code repo:
psu-libraries/psulib_blacklight#71

@antmoth antmoth self-assigned this Sep 24, 2019
@antmoth
Copy link
Contributor

antmoth commented Sep 25, 2019

So... we can disable forgery protection on the bookmark checkboxes, or we can figure out a fix to the problem, which is probably that the csrf token on the bookmark form is not updated when we submit the form and get a response from the server. Either way the core issue is with code that is present in Blacklight.

@jcoyne
Copy link
Member

jcoyne commented Oct 3, 2019

I'm not able to duplicate this. Am I doing it right?

arclight

@mejackreed
Copy link
Collaborator

Try it on the Bookmarks page. I'm seeing it happen there. We are seeing these things intermittent in odd places.

@jcoyne
Copy link
Member

jcoyne commented Oct 3, 2019

Okay, I see it on the Arclight bookmarks page, but curiously I can't see it on the http://demo.projectblacklight.org/. Where is the source for the arclight-demo?

@mejackreed
Copy link
Collaborator

@jcoyne
Copy link
Member

jcoyne commented Oct 3, 2019

One difference I notice between the arclight and the blacklight demo site is that the latter is always submitting the request with an X-CSRF-Token header that matches the meta tag.

@seanaery
Copy link
Contributor

Resolving this issue as part of a review of arclight 1.0.x. This no longer happens with a new vanilla app generated in v1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants