unabridged / motion

Reactive frontend UI components for Rails in pure Ruby
https://github.com/unabridged/motion
MIT License
697 stars 19 forks source link

Fix Consumer Doubling #168

Closed carlzulauf closed 1 year ago

carlzulauf commented 1 year ago

When a consumer option is supplied to motion's createClient, the consumer getter in Client.defaultOptions still gets called during Object.assign, so getFallbackConsumer still gets called and generates an additional ActionCable consumer.

This PR moves consumer presence checking to an explicit statement after Object.assign.

Also improves the logging of Component lifecycle events by attaching the component itself to the logs.

Finally, bumps version to 0.7.1

carlzulauf commented 1 year ago

In case it's useful, this console session illustrates the issue with the getter and Object.assign. The getter still gets called even when being overwritten. Screenshot from 2023-01-24 12-13-30