Skip to content

Commit c1156cf

Browse files
docs: weekly documentation accuracy update
1 parent ffc17c0 commit c1156cf

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

docs/FEATURE_FLAGS.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -227,23 +227,24 @@ const maxSize = api.getServerFeature('max_upload_size', 100 * 1024 * 1024)
227227

228228
2. **Using the composable (recommended for reactive components):**
229229
```typescript
230-
const { serverSupports, getServerFeature, extension } = useFeatureFlags()
230+
const { flags, featureFlag } = useFeatureFlags()
231231

232-
// Check feature support
233-
if (serverSupports('supports_preview_metadata')) {
232+
// Use reactive properties (automatically update if flags change)
233+
if (flags.supportsPreviewMetadata) {
234234
// Use enhanced previews
235235
}
236236

237-
// Use reactive convenience properties (automatically update if flags change)
238-
if (extension.manager.supportsV4.value) {
239-
// Use V4 manager API
237+
// Use reactive computed for custom feature paths
238+
const customFeature = featureFlag('extension.custom.feature', false)
239+
if (customFeature.value) {
240+
// Use custom feature
240241
}
241242
```
242243

243244
3. **Reactive usage in templates:**
244245
```vue
245246
<template>
246-
<div v-if="featureFlags.extension.manager.supportsV4">
247+
<div v-if="flags.supportsManagerV4">
247248
<!-- V4-specific UI -->
248249
</div>
249250
<div v-else>
@@ -253,7 +254,7 @@ if (extension.manager.supportsV4.value) {
253254
254255
<script setup>
255256
import { useFeatureFlags } from '@/composables/useFeatureFlags'
256-
const featureFlags = useFeatureFlags()
257+
const { flags } = useFeatureFlags()
257258
</script>
258259
```
259260

@@ -308,19 +309,17 @@ if feature_flags.supports_feature(sockets_metadata, sid, "your_new_feature"):
308309

309310
2. **For extension features**, update the composable to add convenience accessors:
310311
```typescript
311-
// In useFeatureFlags.ts
312-
const extension = {
313-
manager: {
314-
supportsV4: computed(() => getServerFeature('extension.manager.supports_v4', false))
315-
},
316-
yourExtension: {
317-
supportsNewFeature: computed(() => getServerFeature('extension.yourExtension.supports_new_feature', false))
312+
// In useFeatureFlags.ts, add to the flags reactive object:
313+
const flags = reactive({
314+
// ... existing flags
315+
get yourNewFeature() {
316+
return api.getServerFeature('extension.yourExtension.supports_new_feature', false)
318317
}
319-
}
318+
})
320319

321320
return {
322-
// ... existing returns
323-
extension
321+
flags: readonly(flags),
322+
featureFlag
324323
}
325324
```
326325

0 commit comments

Comments
 (0)