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

Refactor property value and default function resolution #172

Merged

Conversation

SgLy
Copy link
Contributor

@SgLy SgLy commented Jun 28, 2024

Changes:

  1. property.value will only be used for determining the initial value of a property
  2. ensure that initial data and property values will never be undefined when calling property.default throws an error

Breaking change: when determining initial value of a property, if property.default throws an error, property.value will be used in current implementation; now a fallback value will be used, which means property.value will be completely ignored when property.default is a function.

@SgLy SgLy added the enhancement New feature or request label Jun 28, 2024
@SgLy SgLy requested a review from LastLeaf June 28, 2024 07:42
@SgLy SgLy self-assigned this Jun 28, 2024
glass-easel/src/behavior.ts Outdated Show resolved Hide resolved
glass-easel/src/data_proxy.ts Outdated Show resolved Hide resolved
@SgLy SgLy changed the title Better property default function protection [WIP] Better property default function protection Jun 28, 2024
@SgLy SgLy changed the title [WIP] Better property default function protection Refactor property value and default function resolution Jun 28, 2024
@LastLeaf
Copy link
Member

Need some test cases to prove your changes.

@SgLy
Copy link
Contributor Author

SgLy commented Jul 2, 2024

Need some test cases to prove your changes.

Added

@LastLeaf LastLeaf merged commit f372002 into wechat-miniprogram:master Jul 2, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants