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

front: useless request are sent on the infra editor #6971

Closed
clarani opened this issue Mar 22, 2024 · 1 comment · Fixed by #7904
Closed

front: useless request are sent on the infra editor #6971

clarani opened this issue Mar 22, 2024 · 1 comment · Fixed by #7904
Assignees
Labels
area:front Work on Standard OSRD Interface modules kind:bug Something isn't working severity:minor Minor severity bug

Comments

@clarani
Copy link
Contributor

clarani commented Mar 22, 2024

What happened?

When I move my mouse on the editor map, some api calls are sent to fetch the infra, the switch types and the errors

What did you expect to happen?

No api calls

How can we reproduce it (as minimally and precisely as possible)?

  1. Open the network tab
  2. Move your mouse on the editor map

What operating system, browser and environment are you using?

  • Browser: Firefox v109
  • OS: Nixos v22.11
  • Env: Local

OSRD version (top right corner Account button > Informations)

.

@clarani clarani added kind:bug Something isn't working area:front Work on Standard OSRD Interface modules severity:minor Minor severity bug labels Mar 22, 2024
@clarani clarani self-assigned this Mar 29, 2024
@clarani clarani removed their assignment Jun 4, 2024
@sim51
Copy link
Contributor

sim51 commented Jul 1, 2024

When using RTK useLazyQuery, the given fetch function is a RTK query that handles its traditional cache, so we need to unsubscribe to avoid useless queries

Moreover, if the infraID not doesn't change, we don't need to recall it.

I created a hook named useInfra (& useCurrentInfra) in the editor application, but perhaps its place should be inside the infra module.

@sim51 sim51 self-assigned this Jul 1, 2024
sim51 added a commit that referenced this issue Jul 1, 2024
Fix #6971

Unsubscribe some RTK queries to avoid useless queries, by creating
wrapper for useInfra & useSwitchType.
sim51 added a commit that referenced this issue Jul 1, 2024
Fix #6971

Unsubscribe some RTK queries to avoid useless queries, by creating
wrapper for useInfra & useSwitchType.
sim51 added a commit that referenced this issue Jul 2, 2024
Fix #6971

Unsubscribe some RTK queries to avoid useless queries, by creating
wrapper for useInfra & useSwitchType.
github-merge-queue bot pushed a commit that referenced this issue Jul 2, 2024
Fix #6971

Unsubscribe some RTK queries to avoid useless queries, by creating
wrapper for useInfra & useSwitchType.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:front Work on Standard OSRD Interface modules kind:bug Something isn't working severity:minor Minor severity bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants