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(plugin:export): it should have default value 'true' through doc #4111

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

Sorryhx
Copy link
Contributor

@Sorryhx Sorryhx commented Dec 20, 2023

Description

@antv/x6-plugin-export's options table show that the default-value of serializeImages and copyStyles is the true.However, the option argument has been set {} which will cause serializeImages or copyStyles is undefined in runtime. the logical truth code won't be executed.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Enhancement (changes that improvement of current feature or performance)
  • Refactoring (changes that neither fixes a bug nor adds a feature)
  • Test Case (changes that add missing tests or correct existing tests)
  • Code style optimization (changes that do not affect the meaning of the code)
  • Docs (changes that only update documentation)
  • Chore (changes that don't modify src or test files)

Self Check before Merge

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@x6-bot x6-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. PR: unreviewed PR does not have any reviews. labels Dec 20, 2023
// without instance.hasOwnProperty method cause by ts rule.
// the condition will be false if these properties have been set undefined in the target,
// but will be true if these properties are not in the target, cause the doc.
!Object.prototype.hasOwnProperty.call(options, 'copyStyle') &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Because the following judgment is options.copyStyles !== false, so if it is not passed, it is also executed in accordance with true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, we just have a difference about what is the true . It will execute correctly under the strict-Boolean-type. The options.copyStyles !== false is a strict un-equality which likes ===.But, the serializeImages condition in line 209 is not strict which likes ==.So, In my option, we should keep the same style about the serializeImages and copyStyle condition what are both the Boolean value through the docs on the one hand, on the other hand, It should excute false statement when the value is either '', or ``, or null,or undefined,or NAN. All above these just beacuse JS is a fuck weak type language😓.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@NewByVector NewByVector added PR: reviewed-changes-requested PR has reviewed and got Change request event. and removed PR: unreviewed PR does not have any reviews. labels Jan 9, 2024
// without instance.hasOwnProperty method cause by ts rule.
// the condition will be false if these properties have been set undefined in the target,
// but will be true if these properties are not in the target, cause the doc.
!Object.prototype.hasOwnProperty.call(options, 'copyStyle') &&
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@x6-bot x6-bot bot added PR: reviewed-approved PR has reviewed and got Approve from everyone. and removed PR: reviewed-changes-requested PR has reviewed and got Change request event. labels Jan 24, 2024
@NewByVector NewByVector merged commit 75e1ee9 into antvis:master Jan 24, 2024
17 checks passed
@x6-bot
Copy link
Contributor

x6-bot bot commented Jan 24, 2024

👋 @Sorryhx

Congrats on merging your first pull request! 🎉🎉🎉

@x6-bot x6-bot bot added PR: merged PR has merged. and removed PR: reviewed-approved PR has reviewed and got Approve from everyone. labels Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged PR has merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants