refactor(devtools): single source of truth for shared protocol types#8712
Open
Aejkatappaja wants to merge 1 commit into
Open
refactor(devtools): single source of truth for shared protocol types#8712Aejkatappaja wants to merge 1 commit into
Aejkatappaja wants to merge 1 commit into
Conversation
The VNode tree node, component detail entry, and render event shapes were declared three times with identical fields: in the browser extension, in the devtools UI, and in the kit client bridge. Move them into the kit protocol module (DevtoolsVNodeTreeNode in protocol/vnode, DevtoolsRenderEvent in protocol/perf, DevtoolsComponentDetailEntry in protocol/hooks). The client bridge, the extension, and the UI now all import them from @qwik.dev/devtools/kit. No public API change: the same names are still exported, just from the protocol module.
🦋 Changeset detectedLatest commit: 0fdd84a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
commit: |
Contributor
|
@wmertens i done please take a look |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The VNode tree node, component detail entry, and render event shapes were declared three times with identical fields:
packages/browser-extension/src/shared/types.ts(VNodeTreeNode,ComponentDetailEntry,RenderEvent)packages/devtools/ui/src/devtools/page-data-source.ts(same names)packages/devtools/kit/src/client-bridge.ts(DevtoolsVNodeTreeNode,DevtoolsComponentDetailEntry,DevtoolsRenderEvent)Three copies of the same data contract had to be kept in sync by hand.
Solution
Make
@qwik.dev/devtools/kitthe single source of truth.DevtoolsVNodeTreeNodeinprotocol/vnode.ts,DevtoolsRenderEventinprotocol/perf.ts,DevtoolsComponentDetailEntryinprotocol/hooks.ts.kit/client-bridge.tsimports them from the protocol module instead of declaring its own copies, so it becomes a consumer of the shared types too.Devtoolsprefix is kept on purpose: a bareRenderEventwould collide with the DOM lib global.No public API change: the same type names are still exported from
@qwik.dev/devtools/kit, just from the protocol module rather than the client bridge.Verification
@qwik.dev/devtools/kitbuilds and its generated.d.mtsexports all three types.tscon the devtools UI passes with zero errors.tscon the browser extension reports only two preexisting wxtTS2742errors, unrelated to this change.References
QwikDev project board, card "p1 Shared Type Duplication": https://github.com/orgs/QwikDev/projects/6/views/1