Skip to content

Conversation

@mahula
Copy link
Collaborator

@mahula mahula commented Jan 19, 2026

Motivation

While implementing E2E tests for the TipTap rich text editor integration (PR #670), we discovered that clicking hashtags in item popups did not trigger map filtering.

Investigation revealed that the seed data (items.json) contains items with hashtags (e.g., #sustainability, #community), but the tags collection was empty. The hashtag click handler only triggers filtering when it finds a matching tag registered in the backend.

Current Status (on main)

  1. Start and seed the application
  2. Open http://localhost:8080 and click on "Community Garden Berlin" marker
  3. Click any hashtag (e.g., #sustainability) in the popup
  4. Result: Nothing happens - the tags collection is empty, so filtering silently fails
  5. Verify: curl http://localhost:8055/items/tags returns {"data":[]}

Solution

Extended backend/prepare-seed.js to automatically:

  • Extract all #hashtag patterns from text fields in items.json
  • Generate tags.json with unique tags and auto-assigned colors
  • Preserve existing tag colors when re-running the script

The generated tags.json is added to .gitignore since it's derived from items.json.

How to Test

  1. Checkout this branch and start fresh: docker compose down && sudo rm -rf ./data/database && docker compose up -d
  2. Wait for Directus, then seed: cd backend && ./push.sh && ./seed.sh
  3. Observe output: "Found 34 unique hashtag(s)" and "Written 34 tag(s) to tags.json"
  4. Open http://localhost:8080 and click on "Community Garden Berlin" marker
  5. Click #sustainability in the popup
  6. Expected: URL updates to ?tags=sustainability and map filters accordingly
  7. Verify: curl http://localhost:8055/items/tags returns 34 tags

Extend prepare-seed.js to extract hashtags from item text fields and
generate tags.json automatically during the seeding process. This ensures
hashtag click filtering works correctly in the application.

Changes:
- Extract all #hashtag patterns from items.json text fields
- Generate tags.json with unique tags and auto-assigned colors
- Preserve existing tag colors when re-running the script
- Add tags.json to .gitignore (auto-generated file)

The script runs as part of seed.sh, so CI/CD pipelines and local
development will automatically have matching tags for all hashtags
used in seed data items.
@mahula mahula requested a review from antontranelis January 19, 2026 14:31
@mahula mahula self-assigned this Jan 19, 2026
@mahula mahula added bug Something isn't working backend labels Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants