Jayyadav1903 opened a new pull request, #4154:
URL: https://github.com/apache/streampipes/pull/4154
# Fix Filter Propagation Between Resources and Assets
## Overview
This pull request fixes an issue where filters applied in one resource view
(e.g., Connect) were lost or incorrectly applied when navigating to the Asset
View.
The root cause was that filter state was implicitly tied to component
lifecycle events (such as `ngOnDestroy`) and global toolbar initialization,
leading to unintended resets during navigation.
This change makes filter lifecycle management **explicit, predictable, and
context-aware**.
---
## Changes Made
### Asset Browser Toolbar
- Removed `resetFilters()` from `ngOnDestroy`
- Prevents filter state from being cleared when the toolbar component is
destroyed during navigation
### Core Toolbar
- Removed `applyAssetLinkType('')` from `ngOnInit`
- Prevents the global toolbar from resetting asset context on every page load
- Context initialization is now handled by the owning view
### Session Handling
- Added `resetFilters()` to `logout()`
- Ensures filter state is cleared when a user session ends
- Prevents stale filters from leaking across sessions
### Asset Overview
- Added `applyAssetLinkType('')` to `ngOnInit`
- Explicitly defines the Asset View context as “All Assets”
- Prevents inheriting restricted contexts (e.g., `adapter`) from previously
visited views
---
## Intended Behavior Change
- Filters **persist across navigation** between resource views
- Filters are cleared only when:
- the user clicks **Reset**, or
- the user **logs out**
- Context boundaries (such as Asset Overview) explicitly define asset scope
This behavior change is intentional and required for correct filter
propagation.
---
## Verification
### Manual Verification
#### Filter Propagation
1. Navigate to **Connect**
2. Apply a filter (Label, Site, etc.)
3. Navigate to **Assets**
4. Filter remains active and the asset list reflects it
#### Context Reset
1. Navigate to **Connect** (context = `adapter`)
2. Navigate to **Assets**
3. Asset View shows all assets (context reset via `applyAssetLinkType('')`)
#### Logout
1. Apply filters
2. Logout and log back in
3. Navigate to **Assets**
4. No filters are active
#### Reset Button
1. Apply filters
2. Click **Reset**
3. Filters are cleared and the view updates
---
## Automated Tests
- Existing Cypress tests under `cypress/tests/assetManagement` pass
- No new tests were added, as this change adjusts UI state lifecycle rather
than introducing new logic paths
- Existing regression coverage validates navigation and reset behavior
---
## Notes
- This PR intentionally decouples filter state from component destruction
- Component lifecycle is no longer treated as a state boundary
- Filter lifecycle is now owned by:
- explicit user actions (Reset)
- session lifecycle (Logout)
- context-defining views
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]