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

Console exception when reflex updates a page that didn't trigger the update #336

Closed
rockhymas opened this issue Oct 25, 2020 · 9 comments · Fixed by #335
Closed

Console exception when reflex updates a page that didn't trigger the update #336

rockhymas opened this issue Oct 25, 2020 · 9 comments · Fixed by #335
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rockhymas
Copy link

rockhymas commented Oct 25, 2020

Bug Report

Describe the bug

Reflex updates that are not triggered by the client they are being sent to, show a console error:

stimulus_reflex.js:387 Uncaught TypeError: Cannot read property 'completedOperations' of undefined
    at HTMLDocument.beforeDOMUpdateHandler (stimulus_reflex.js:387)
    at dispatch (cable_ready.js:83)
    at Object.morph (cable_ready.js:168)
    at Object.perform (cable_ready.js:349)
    at Subscription.received (stimulus_reflex.js:87)
    at action_cable.js:536
    at Array.map (<anonymous>)
    at Subscriptions.notify (action_cable.js:535)
    at Connection.message (action_cable.js:369)

Introduced by #299. The promises hash doesn't have an entry for the reflexId passed, but there is not check for null/undefined.

To Reproduce

Use the TodoMVC app in two browser tabs, but with StimulusReflex 3.3.0.
Check off a todo.
Note that it gets checked off in the other tab.
But there is also the console error above.

Expected behavior

No javascript error

Versions

StimulusReflex

  • Gem: 3.3.0
  • Node package: 3.3.0

External tools

  • Ruby: 2.6.6
  • Rails: 6.0.3
  • Node: 10.19.0

Browser

  • Browser Chrome
  • Version 80
@Schlipak
Copy link

I'm having the same issue, seems related to #335.

@leastbad
Copy link
Contributor

Hi @rockhymas, is this issue fixed by running #335 on your local machine?

It'd be really, really helpful to the project if you were able to help us confirm that our fix for your problem works as intended.

@rockhymas
Copy link
Author

I'd love to help out. I'm still fairly new to rails and stimulus reflex. How do I go about using a non-released version of stimulusreflex in my rails app?

@leastbad
Copy link
Contributor

You are in luck! I wrote a new documentation section for you the other day:

https://docs.stimulusreflex.com/setup#running-a-branch-to-test-a-github-pull-request

@rockhymas
Copy link
Author

Sweet, that got me unblocked for bit. I now have both the gem and the node package, but the javascript isn't being included in webpack now, so I see this error on page load:

Uncaught Error: Cannot find module 'stimulus_reflex'
    at webpackMissingModule (index.js:1)
    at Module../app/javascript/controllers/index.js (index.js:1)
    at __webpack_require__ (bootstrap:19)
    at Module../app/javascript/packs/application.js (application.js:1)
    at __webpack_require__ (bootstrap:19)
    at bootstrap:83
    at bootstrap:83

Yarn is saying I need to link stimulus_reflex, but when I try to do that it says stimulus_reflex isn't registered. I don't want to turn this issue into my personal tech support, but I'm stumped on this one.

@leastbad
Copy link
Contributor

Can you confirm that you've run yarn install --check-files?

Also, if you're on Discord, this could be easier to solve.

@rockhymas
Copy link
Author

Yeah, I've run that, output shows no errors. Will jump on discord.

@leastbad
Copy link
Contributor

Hey @rockhymas, are you sorted on this issue?

@leastbad leastbad added the bug Something isn't working label Oct 31, 2020
@leastbad leastbad self-assigned this Oct 31, 2020
@leastbad leastbad added this to the 3.4.0 milestone Oct 31, 2020
@leastbad leastbad linked a pull request Oct 31, 2020 that will close this issue
2 tasks
@rockhymas
Copy link
Author

Yeah, this is great, and I've learned a lot. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants