Closed acouch00 closed 10 years ago
I don't have access to the machine I develop on for a while, so I'll ask here again: do you see any js errors? If so, that'll help with debugging this.
Sorry for the delay.
Yes, the error is : Uncaught TypeError: Object [object Object] has no method 'popover'
. Stackoverflow didn't really turn up any useful suggestions on this, and I'm still not entirely sure why this "works all of a sudden" after hitting refresh.
Without tracking it myself, scripting errors like that can occur when JS code isn't placed in (or called from if using a module) a DOM-ready function. There are specific functions that explicitly wait until the page is completely loaded before the script runs, often because that script needs to manipulate the loaded page elements.
This is usually the root of problems involving script claiming something doesn't exist when it "clearly and obviously does." Similar race conditions can occur when scripts are linked out of order (one needs functions within the other, like how much of our scripts rely on the jQuery library to already be loaded) or, more subtly, variables and functions are incorrectly scoped.
JS bug hunting can be arduous.
[That said I've been up for a day and a half after three hours of sleep so this could possibly be wholly unrelated. At least it's an interesting knowledge-dump!]
Thanks, Austin. I looked into this one for quite a bit, and I did run across mentionings of what you're talking about. I've double checked that the script is "function ready" and not "function load," but it's always possible that there are some dependencies that aren't being accounted for. In either case, the page source always shows that the js function was rendered properly.
Hi Rhea,
Sorry I didn't see your comments on this before our meeting today. But I did investigate and found exactly what you did-- that everything seems like it should work, but it doesn't. As I said before, I even tried moving the script around (which shouldn't matter since it is in a doc.ready function) and it didn't change anything. If anyone else wants to help, perhaps another set of eyes will be able to detect the issue. It's also possible that it has to do with a rails-jquery interaction of some sort, so I might look into this later if it still isn't fixed.
On Tue, Dec 3, 2013 at 7:17 AM, Rhea Kokila notifications@github.comwrote:
Thanks, Austin. I looked into this one for quite a bit, and I did run across mentionings of what you're talking about. I've double checked that the script is "function ready" and not "function load," but it's always possible that there are some dependencies that aren't being accounted for. In either case, the page source always shows that the js function was rendered properly.
— Reply to this email directly or view it on GitHubhttps://github.com/japacible/commission-me/issues/224#issuecomment-29717797 .
@kcorman -- Thanks for looking into this for a little bit and sharing your findings!
How is the status on this?
This issue still exists on wip-commissions, though it looks a bit different now on the review page as other panels are populating but the main javascript one that displays the choices the commissioner made is still not being rendered until refresh.
This issue also exists on master.
Going to look into this now, I feel like it's a pressing issue.
Just to offer a little insight on this issue: There are several places where we save the user object after changing a field (such as the SessionsHelper::sign_in because we are updating their remember token). The thing is, a user record doesn't actually contain a password field, only a password digest. The only time it contains an actual password field is when we are creating or updating the user. Consequently we should only be verifying it then. That being said, the code really looks like it specifies this, but it seems to be falling through some how and verifying at all times that save is called.
Okay I'm pretty sure this is fixed. Just pushed this ff9c28c to master since it was a small change. If someone else can confirm it fixed we can close this.
stack overflow post I followed: http://stackoverflow.com/questions/17881384/jquery-gets-loaded-only-on-page-refresh-in-rails-4-application
@kcorman I just checked and it works for me.
Seems like it's been fixed. Closing this.
This occurs across multiple pages and I feel that it's a hi-priority issue.
Case 1 -- Popover (see originating issue)
Case 2 -- Viewing a Received / Sent Commission Request