Skip to content

fix(vue): support computed getter trigger - #638

Merged
harlan-zw merged 1 commit into
mainfrom
fix/vue-use-script-computed-getter
Jan 15, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/vue-use-script-computed-getter

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

❓ 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

// ❌ Before: getter functions didn't work (silently failed to trigger)
  const shouldLoad = ref(false)
  useScript('https://example.com/script.js', {
    trigger: () => shouldLoad.value
  })

  // ✅ After: getter functions now work the same as refs
  const shouldLoad = ref(false)
  useScript('https://example.com/script.js', {
    trigger: () => shouldLoad.value  // works!
  })

  // All three formats are now equivalent:
  trigger: shouldLoad                          // ref
  trigger: computed(() => shouldLoad.value)    // computed ref  
  trigger: () => shouldLoad.value              // getter function

@harlan-zw
harlan-zw marked this pull request as ready for review January 15, 2026 11:33
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Bundle Size Gzipped
Client (Minimal) 11.2 kB 4.7 kB
Server (Minimal) 10.1 kB 4.2 kB
Vue Client (Minimal) 12.3 kB 5.1 kB
Vue Server (Minimal) 11 kB 4.5 kB

@harlan-zw
harlan-zw merged commit fd63a28 into main Jan 15, 2026
@harlan-zw harlan-zw mentioned this pull request Apr 4, 2026
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.

1 participant