FlowFuse / flowfuse

Connect, collect, transform, visualise, and interact with your Industrial Data in a single platform. Use FlowFuse to manage, scale and secure your Node-RED solutions.
https://flowfuse.com
Other
283 stars 64 forks source link

Error notification banner pops up after instance removal #3586

Closed ppawlowski closed 7 months ago

ppawlowski commented 8 months ago

Current Behavior

After removing an instance I keep receiving a pop-banner with the error message about unavailable Node-RED logs. See the attached video for the reference.

https://github.com/FlowFuse/flowfuse/assets/7622533/2c78529d-a2de-4913-af76-3ed578b1b526

Expected Behavior

I should not receive such popup message since the instance does not exist anymore.

Steps To Reproduce

  1. Create the instance.
  2. Delete it.
  3. Navigate across your application.

Environment

Have you provided an initial effort estimate for this issue?

I can not provide an initial effort estimate

Steve-Mcl commented 7 months ago

Steps To Reproduce

  1. Create the instance.
  2. Delete it.
  3. Navigate across your application.

@ppawlowski do you remember doing anything else between steps 1 and 2, like:

Using these 3 steps, is this 100% repeatable for you?

Steve-Mcl commented 7 months ago

I have tried the 3 steps above. I have tried deleting the instance from the instance logs page, unfortunately I cannot recreate this.

If you could get down a reproduceable set of steps that would help immensely.

Thanks.

@ppawlowski ^

ppawlowski commented 7 months ago

I was trying to reproduce it for the last hour, and it happened to me once - you can see it in the video. However, when I followed the same steps as in the video during another attempt, everything worked fine, and the error pop-up did not appear.

https://github.com/FlowFuse/flowfuse/assets/7622533/d0828f59-a62a-47d9-b102-074b30f3608b

ppawlowski commented 7 months ago

After creating tens of node-red instances today, I am unable to reproduce the error. This includes following the steps I presented in the last video. For me, it looks like a typical edge case error which requires a bit of luck and proper moon and the Earth alignment to happen.

Steve-Mcl commented 7 months ago

@ppawlowski i managed to recreate this by slowing the response from API call to /api/v1/projects/:id/logs

Essentially, the component was being mounted but before the await this.fetchData() call had elapsed, the component was being unmounted. When await this.fetchData() eventually resolved & the poll timer was created, causing this error.

This is easily fixed by either removing the async from mounted or moving the poll timer creation to AFTER the call to await this.fetchData()

Additionally, i noted you had, in your first instance managed to do this twice (2 consecutive toast messages every 5 secs) so i think some "route check" logic should also be employed in the poll timer callback to verify the URL (route) is actually a log page before attempting to fetch data.