Review of flush defaults
See original GitHub issueThis is a review of the current usage of flush timing in vueuse. I think I understand better the reason the previous default for useRefHistory
was 'sync'
now. If we would have called this composable watchRefHistory
, I think it will be easier to see why I pushed for ‘pre’. If the name would be computedRefHistory
, then 'sync'
would be better. I wonder if using “watch” as prefix instead of “use” is not better, but maybe if the documentation is clear this is not a problem.
controlledComputed
controlledComputed
is using flush: 'sync'
and it is not configurable, I think this is correct because it is the way computed
works.
syncRef, bySyncRef
syncRef
defaults to 'sync'
, but in the docs it says the default is ‘post’.
Because the name is syncRef, it is kind of hard to not use ‘sync’ as the default here. I think it also should behave like computed. Also, bySyncRef
is not configurable and is using 'sync'
I can send a PR to change the default in the docs to 'sync'
useStorage
useStorage
is using 'post'
as its default and it is not configurable. Was 'post'
used because there was a limitation about making flush configurable for this one?
when
when
is using 'sync'
as its default, but it looks more like a watcher to me. I think we could change its default to ‘pre’ to align it to the watch API
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
No problem. I don’t care about merge or rebase as long as the final generated changelogs are meaningful. And yeah PR will better which helps me remember to review.
Pushed the section to the doc @antfu https://github.com/antfu/vueuse/commit/dfc72eca3b2b58607fcef58bf48fc702fa5c1958 But looks like I pushed a merge commit, I do not know if I can rebase it, truly sorry about it 😦 I’ll do a PR even for adding docs from now on.