google-adsense icon indicating copy to clipboard operation
google-adsense copied to clipboard

refactor(props): remove unnecessary withDefaults()

Open nexoscreator opened this issue 4 weeks ago โ€ข 0 comments

Replaced withDefaults() in Adsbygoogle.vue with destructured default values for props to align with Vue's best practices and suppress compiler warnings.

๐Ÿ”— Linked issue

Resolves #207 also #205

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [x] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

This pull request replaces the use of withDefaults() in Adsbygoogle.vue with destructured default values for props.

Why this change?

  • Aligns with Vue 3's best practices for handling props.
  • Resolves the compiler warning:
    WARN  [@vue/compiler-sfc] withDefaults() is unnecessary when using destructure with defineProps().
    Reactive destructure will be disabled when using withDefaults().
    Prefer using destructure default values, e.g., const { foo = 1 } = defineProps(...).
    

What problem does this solve?

It improves maintainability and readability of the code by eliminating unnecessary usage of withDefaults(), ensuring adherence to modern Vue conventions.

nexoscreator avatar Jan 28 '25 10:01 nexoscreator