-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Devtools for useSubscription
#374
Changes from all commits
0617f68
ad78a4a
0c89425
4899c02
08535d5
24e87fa
3249a73
45ac5e3
eb76902
4259837
7363a72
b5bb01d
67a0a84
0b19dab
b5cfdf6
0eb0e8c
8c55a7f
e8c4306
e6f03d2
98a988b
f169641
bb1fddb
f493340
db83c95
72a0510
e3e4c97
f4b2832
cea529b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
type App, | ||
setupDevtoolsPlugin | ||
} from '@vue/devtools-api' | ||
import { type Plugin } from 'vue' | ||
import * as useSubscriptionDevtools from '@/useSubscription/useSubscriptionDevtools' | ||
|
||
export const plugin: Plugin = { | ||
install(app: App): void { | ||
setupDevtoolsPlugin({ | ||
id: 'prefect-vue-compositions-devtools', | ||
label: 'Prefect Devtools', | ||
packageName: '@prefecthq/vue-compositions', | ||
homepage: 'https://www.prefect.io/', | ||
settings: { | ||
...useSubscriptionDevtools.SUBSCRIPTION_DEVTOOLS_SETTINGS, | ||
}, | ||
enableEarlyProxy: true, | ||
app, | ||
}, (api) => { | ||
useSubscriptionDevtools.init(api) | ||
}) | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,20 @@ When a subscription is removed the channel interval is recalculated. A subscript | |
| unsubscribe | `() => void` | | Remove the subscription from the channel | | ||
| subscribe | `() => subscription<action>` | | Resubscribes to the channel using the same arguments | | ||
|
||
## Debugging | ||
`useSubscription` comes with its own Vue devtools plugin for debugging purposes. | ||
|
||
To use, just install the Vue plugin onto your app: | ||
```typescript | ||
import { plugin as VueCompositionsDevtools } from '@prefecthq/vue-compositions' | ||
|
||
const app = createApp(App) | ||
if (/*not in production*/) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this could be better, but I could use a hand getting this right... I think ideally you'd just install this plugin onto your app and the plugin itself would no-op if in production and would also hint to a bundler to skip stuff for tree-shaking. Here's the relevant docs - https://devtools.vuejs.org/plugin/plugins-guide.html#tree-shaking-for-production but I feel like those variables aren't the ones we want? 😕 I looked at a few other codebases - for example, vee-validate's plugin only checks obv, the debugtooling would have to be included in prod builds of this package so I don't want to do some check that will ultimately skip including the devtools in the package since an app would use the "production" build of this package. |
||
app.use(VueCompositionsDevtools) | ||
} | ||
``` | ||
|
||
> Note: to limit runtime overhead, only install the plugin if in development | ||
|
||
Once installed, open the Vue devtools and you should see a new tab and timeline layer | ||
for `Subscriptions`. The devtool plugin tracks all active subscriptions and their underlying channels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I need these for my vs code to run eslint on save...
b/c by default it's just .js ?
but now i'm slightly confused b/c. ... how dis work before. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh that is weird 🤔 but that's what we have in ui-library 🤷