Skip to content

feat: integrate trace mark with render#25

Merged
sheremet-va merged 5 commits into
mainfrom
03-09-feat_integrate_trace_mark_with_render
Mar 10, 2026
Merged

feat: integrate trace mark with render#25
sheremet-va merged 5 commits into
mainfrom
03-09-feat_integrate_trace_mark_with_render

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Vue counterpart of vitest-community/vitest-browser-react#47 using marvelous thenable trick vitest-community/vitest-browser-react#47 (comment).

Example

image

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hi-ogawa hi-ogawa marked this pull request as ready for review March 9, 2026 08:36
Comment thread src/pure.ts Outdated
Comment thread src/pure.ts
return Promise.resolve(value).then(onfulfilled, onrejected)
}
catch (e) {
return Promise.reject(e).then(onfulfilled, onrejected)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need Promise.reject and Promise.resolve? Shouldn't this just be onfulfilled(value), onrejected(e)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There's subtle difference and I believe Promise.resolve/reject is robust and supposedly this is manual thenable implementation idiom (Claude told me so).

A few edge case I came up with is:

  • promise.then().then(...): then with empty arguments should return same-ish promise
  • promise.then(() => { throw ... }, onrejected): when onfulfilled (synchronously) throws, it shouldn't handled by its own onrejected.

Comment thread src/pure.ts
/**
* Unmount the component. Also records a `vue.unmount` trace mark.
*
* Synchronous usage is deprecated and will be removed in the next major version.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we keep sync with a @deprecated tag? The same for other APIs (in svelte too)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IDE cannot pick overload with sync/async return types, so either deprecated highlighted everywhere or nowhere. What are you suggestion to write types here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, I see. Since there is no difference in arguments, we can’t really overload

@sheremet-va sheremet-va merged commit 872fd59 into main Mar 10, 2026
4 checks passed
This was referenced Mar 13, 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.

2 participants