Skip to content

Conversation

@stavros-tsioulis
Copy link
Contributor

@stavros-tsioulis stavros-tsioulis commented Jul 10, 2025

Hello, Vue has a more flexible approach to managing reactivity on composables with MaybeRefOrGetter types. Previously, with string | Ref<string>, computed or simple getter variables would not be allowed as TypeScript values of useImage (even though they would work as typeof would fail the string check).

On the code side, this allows:

const imageUrl = computed(() => /* ... */)
const image = useImage(imageUrl)
const { imageUrl } = defineProps<{
  imageUrl: string
}>()

const image = useImage(() => imageUrl)

There's a little perf upgrade of packaging all watchable values into one computed instead of creating up to 3 refs!

Happy to address any concerns about it :)

@stavros-tsioulis
Copy link
Contributor Author

This is a little out of topic for this PR, but I had to update canvas to version 3 so that I could install the dependencies on my M-series Mac. Turns out canvas@2 doesn't have an ARM binary, so it would 404 on npm install. Tests seemed to run and pass just fine, so it may be worth considering making a dep upgrade.

@lavrton lavrton merged commit 0c4fd10 into konvajs:master Jul 14, 2025
1 check passed
@lavrton
Copy link
Member

lavrton commented Jul 14, 2025

Thanks. Released.

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.

2 participants