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(playground) app shouldn’t crash while user is typing #9316

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chrisgervang
Copy link
Collaborator

Background

The playground currently crashes as the user is typing. For example, an empty object, like layers: [ { } ], will be parsed as a plain object and passed to deck, which, of course will throw an error.

Change List

  • post process json props to filter out invalid objects

@coveralls
Copy link

coveralls commented Dec 21, 2024

Coverage Status

coverage: 91.703%. remained the same
when pulling dc45214 on chrisgervang-patch-1
into 06f80f1 on master.

Copy link
Collaborator

@felixpalmer felixpalmer left a comment

Choose a reason for hiding this comment

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

Have you tested if this still works after minification? Ie running ‘yarn build-staging’ rather than ‘yarn start’ in website ?

},

postProcessConvertedJson: json => {
// Filter out invalid props. Typically, props will be invalid while the user is typing.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are several ways to address this.
Perhaps we could make deck more resilient and not fail on one bad component...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True. I figured it was for a bit of perf gains, and to keep things simpler. It could be argued that only something like this json module would need validation since here the end user is hooking into props directly whereas most apps have some abstraction in-between.

On the flip side, validation can be this simple.

@ibgreen
Copy link
Collaborator

ibgreen commented Dec 21, 2024

Have you tested if this still works after minification? Ie running ‘yarn build-staging’ rather than ‘yarn start’ in website ?

Is it the check for widget.onAdd you are looking at? I see your point but I have never seen method names being minified (just global symbols), would actually be a pleasant surprise to me if they were.

@chrisgervang chrisgervang mentioned this pull request Dec 22, 2024
36 tasks
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.

4 participants