V31 Persist event display filter#3744
V31 Persist event display filter#3744frederikja163 wants to merge 6 commits intoopenfrontio:mainfrom
Conversation
Closes openfrontio#3739 Adds client side persistence to the event display filters.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughEventsDisplay now persists per-MessageCategory event filter toggles to browser localStorage, restores them on connectedCallback, and updates localStorage when toggles change, then requests a UI update. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant ED as EventsDisplay
participant LS as LocalStorage
participant UI as Renderer
Note over ED,LS: On connectedCallback
ED->>LS: getItem(categoryKey) for each MessageCategory
LS-->>ED: "true" / "false" / null
ED->>ED: set eventsFilters from stored values
ED-->>UI: request initial render
Note over User,ED: On toggle
User->>ED: click toggle(category)
ED->>ED: compute next boolean, update eventsFilters
ED->>LS: setItem(categoryKey, "true"/"false")
LS-->>ED: (ack)
ED->>UI: requestUpdate()
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/client/graphics/layers/EventsDisplay.ts`:
- Around line 106-118: The persistence uses bare category names and uncaught
localStorage calls; change both loadFilter (called from connectedCallback) and
toggleEventFilter to use a namespaced key like `eventsFilter:${category}`, wrap
localStorage.getItem/setItem in try/catch to handle storage-unavailable errors,
and make connectedCallback iterate over Object.values(MessageCategory) calling
loadFilter(category) instead of five hard-coded calls so new categories are
picked up automatically; ensure loadFilter reads the namespaced key and sets
this.eventsFilters, and toggleEventFilter writes the same namespaced key inside
a try/catch (no-op if storage fails).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 55154818-d5a9-4e36-8729-3ca7f016e69d
📒 Files selected for processing (1)
src/client/graphics/layers/EventsDisplay.ts
|
@iiamlewis this should be ready to merge, not sure if there are tests i need to add or not. But if i am let know i will happily do it. |
If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #3739
Description:
Adds client side persistence to the event display filters.
Not sure if tests are necessary for this. But if they are i will happily add them.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
Frederikja