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

fix(measure): UI buttons unresponsive/streamline socket URL handling #191

Merged
merged 3 commits into from
Jan 17, 2024
Merged

fix(measure): UI buttons unresponsive/streamline socket URL handling #191

merged 3 commits into from
Jan 17, 2024

Conversation

nnnoel
Copy link
Contributor

@nnnoel nnnoel commented Jan 17, 2024

This PR is a follow-up to #186 addressing this issue comment.

The issue was caused by the webapp connecting to a fixed socket server url (http://localhost:3000). To resolve this, we server-side render data into a (__FLASHLIGHT_DATA__) object, which is now available in the window context of the webapp. This change enables the webapp's socket client to connect to a dynamic server url.

A notable aspect of this change is its impact on unit testing, particularly for the MeasureWebApp component. Related tests now require setting up the window.__FLASHLIGHT_DATA__ context before importing MeasureWebApp. This is crucial because if window.__FLASHLIGHT_DATA__.serverSocketUrl is not initialized correctly, the webapp's socket connection will fail, leading to test failures that may not be immediately apparent. While this adds a layer of complexity to the initial testing approach, it's a necessary trade-off for the enhanced dynamism in the socket server connections.

#189

Copy link

netlify bot commented Jan 17, 2024

Deploy Preview for flashlight-docs canceled.

Name Link
🔨 Latest commit 241d5b2
🔍 Latest deploy log https://app.netlify.com/sites/flashlight-docs/deploys/65a7ebf6009b6d0008846b4b

@nnnoel nnnoel marked this pull request as draft January 17, 2024 07:15
@nnnoel nnnoel marked this pull request as ready for review January 17, 2024 10:09
@flashlight-bot
Copy link
Contributor

Flashlight Automated Report 🔦

Seemingly Jest can fail even though tsc is passing properly
Since we catch errors in "yarn tsc" already, we don't need jest to bother us about it anyway
I think ts-jest doesn't recognize properly the .d.ts definition basically
@flashlight-bot
Copy link
Contributor

Flashlight Automated Report 🔦

Copy link
Member

@Almouro Almouro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to do the trick! Thanks for doing this!
Took the liberty of adding a commit to fix the CI, merging and releasing soon ✅

@Almouro Almouro merged commit 66b0899 into bamlab:main Jan 17, 2024
6 of 7 checks passed
@nnnoel nnnoel deleted the fix-measure-streamline-socket-url-handling branch January 18, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants