Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 386: Löschen von Asset führt zu Endlosschlaufe #406

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

daniel-va
Copy link
Contributor

Resolves #386 and #370.

@daniel-va daniel-va requested a review from TIL-EBP February 5, 2025 14:54
Copy link

sonarqubecloud bot commented Feb 5, 2025

Copy link
Contributor

@TIL-EBP TIL-EBP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two bugs are indeed resolved, but the browser navigation is now broken

currentAsset: state.currentAsset?.assetId === assetId ? undefined : state.currentAsset,
results: {
...state.results,
data: state.results.data.filter((it) => it.assetId !== assetId),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really necessary? We are still performing a search, so the asset will not be there anyways.
Alternatively, you could stop the request from happening, but this seem s overly compoicatead for little gain

ofType(actions.handleSuccessfulDeletion),
switchMap(async ({ assetId }) => {
await this.routingService.navigateBack(['/']);
await this._router.navigate([], {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little weird to navigate twice just to get rid of the asset Id in th url. And it also messes with the history (Once I delete an assset and try to navigate backwards with the mouse buttons, i am stuck - when using the browser buttons though it works

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do the navigation after removing the asset from the state?

if (this.isUpdatingUrl || !(event instanceof NavigationEnd)) {
return;
}
this.params = await firstValueFrom(this.paramsFromStore$);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks back navigation;
You are reading from the store and writign the same thing back (except for favorites), but when navigatin back, you need to use the url params to write to the store (And not the store params themselves)

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.

Löschen von Asset führt zu Endlosschlaufe
2 participants