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 ReflexData parsing #688

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

Matt-Yorkley
Copy link
Contributor

@Matt-Yorkley Matt-Yorkley commented Feb 25, 2024

Bug Fix

Description

The data in StimulusReflex::ReflexData was recently changed to transform all keys to underscored keys without preserving the original kebab-case keys (like data-controller), but this causes breaking changes elsewhere in the codebase. Both sets of keys need to be preserved but this was missed by the relevant tests because the test input was using a plain hash instead of instantiating a ReflexData object (see updated test setup).

Why should this be added

The previous change caused issues like missing attributes in element.dataset in Reflexes. It's in main, but it's not released yet.

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing

The data in ReflexData was recently changed to transform all keys to underscored values without preserving the originals (like "data-reflex"), but this causes problems elsewhere (like missing attributes in element.dataset). Both sets of keys need to be present (see updated test setup).
Copy link

netlify bot commented Feb 25, 2024

Deploy Preview for stimulusreflex ready!

Name Link
🔨 Latest commit 6b6453d
🔍 Latest deploy log https://app.netlify.com/sites/stimulusreflex/deploys/65db8ae7dbc68f0008151db6
😎 Deploy Preview https://deploy-preview-688--stimulusreflex.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@marcoroth marcoroth left a comment

Choose a reason for hiding this comment

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

Thank you @Matt-Yorkley! I'm wondering if there's an easy way how we can test this in a full-stack setup so the tests could catch another regression!

@marcoroth marcoroth merged commit 078db30 into stimulusreflex:main Mar 6, 2024
14 checks passed
@Matt-Yorkley
Copy link
Contributor Author

Matt-Yorkley commented Mar 6, 2024

I had the same thought, a couple of full-stack tests would be great. Maybe a dummy app and some System Tests with Capybara/Cuprite is the way to go?

@marcoroth marcoroth mentioned this pull request Mar 6, 2024
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.

2 participants