Skip to content

feat: remove org-id annotation requirement#20

Closed
talissoncosta wants to merge 5 commits intomainfrom
feat/remove-org-id-annotation
Closed

feat: remove org-id annotation requirement#20
talissoncosta wants to merge 5 commits intomainfrom
feat/remove-org-id-annotation

Conversation

@talissoncosta
Copy link
Contributor

@talissoncosta talissoncosta commented Feb 24, 2026

Summary

This PR simplifies the plugin configuration by removing the flagsmith.com/org-id annotation requirement. The organization ID is now automatically derived from the project data, reducing the configuration burden on users.

Changes

Core Changes

  • Removed org-id annotation requirement: The useFlagsmithUsage hook now only requires project-id
  • Automatic org-id derivation: Organization ID is extracted from projectData.organisation
  • Simplified API: Removed orgId parameter from useFlagsmithUsage hook

Component Updates

  • Updated FlagsmithUsageCard to derive org-id from project data
  • Dashboard link construction now uses derived org-id

Developer Experience

  • Added /flagsmith-complete demo page: Shows all three components (FlagsTab, Overview Card, Usage Card) on one screen
  • Perfect for testing, screenshots, and documentation
  • Demonstrates the simplified annotation requirement

Documentation

  • Updated README to remove org-id annotation from examples
  • Updated documentation prompt for Flagsmith docs contribution
  • Added note explaining automatic org-id derivation

Tests

  • Updated useFlagsmithUsage.test.tsx to reflect simplified API
  • Removed all org-id parameters from test cases

Before vs After

Before:

annotations:
  flagsmith.com/project-id: '12345'
  flagsmith.com/org-id: '67890'  # Required

After:

annotations:
  flagsmith.com/project-id: '12345'
  # Organization ID automatically derived! ✨

Benefits

  1. Simpler configuration: Users only need to provide one annotation instead of two
  2. DRY principle: We don't ask users for data we can fetch ourselves
  3. Better UX: Less chance of configuration errors
  4. Consistent with FlagsTab: Already uses this pattern successfully

Testing

All three components work with only project-id annotation:

  • ✅ Feature Flags Tab
  • ✅ Overview Card
  • ✅ Usage Card

Try it out: yarn start and visit /flagsmith-complete

Breaking Changes

⚠️ This is technically a breaking change to the API signature of useFlagsmithUsage, but:

  • The org-id annotation was already documented as "optional"
  • Existing users with org-id annotation will continue to work (it's just ignored)
  • This simplifies the API and improves the user experience

talissoncosta and others added 5 commits February 6, 2026 12:02
The Flagsmith API returns tags as an array of numeric IDs, but the UI
was displaying these IDs directly. This fix fetches tag definitions
from the project and creates a lookup map to display labels instead.

- Add FlagsmithTag interface and getProjectTags method to FlagsmithClient
- Update useFlagsmithProject hook to fetch tags and provide tagMap
- Update components to use tagMap for resolving tag labels
- Update mock handlers with realistic tag data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create a shared TagChip component that displays colored tags using
the Flagsmith dashboard style: light tinted background, subtle border,
and darkened text color derived from each tag's color field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of displaying numeric tag IDs as a fallback, the TagChip
component now returns null when the tag is not found in the tagMap.
This prevents confusing numeric IDs from appearing in the UI.

Also removed unnecessary parseInt conversion for projectId in the
getProjectTags API call since the parameter already accepts strings.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Exports TagChip from the shared components index file for consistency
with other shared components. Updates imports in ExpandableRow and
FeatureDetailsGrid to use the cleaner import pattern.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove org-id annotation requirement - automatically derive from project data
- Simplify useFlagsmithUsage hook to only require project-id
- Update FlagsmithUsageCard to derive org-id from project
- Add /flagsmith-complete demo page showing all three components
- Update tests to reflect simplified API
- Update documentation to remove org-id references

This improves developer experience by reducing required configuration.
The organization ID is always available in the project response, so
requiring users to manually provide it was unnecessary.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@talissoncosta talissoncosta marked this pull request as ready for review February 24, 2026 12:28
@talissoncosta talissoncosta changed the base branch from main to fix/display-tag-labels February 24, 2026 12:28
@talissoncosta talissoncosta changed the base branch from fix/display-tag-labels to main February 24, 2026 12:29
@talissoncosta
Copy link
Contributor Author

Closing in favor of clean rebased branch

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.

1 participant