conda-incubator / conda-store-ui

conda-store-ui is a frontend for conda-store powered by react
https://conda-incubator.github.io/conda-store-ui/
BSD 3-Clause "New" or "Revised" License
13 stars 18 forks source link

[BUG] - Active build isn't updated in the UI until environment tab is closed #334

Open kcpevey opened 9 months ago

kcpevey commented 9 months ago

Describe the bug

When you specify a new active build, some parts of the UI don't update until the environment tab is closed.

Expected behavior

I expect the UI to update views when I make changes.

How to Reproduce the problem?

I believe #333 is related in that I think they both are rooted in there not being a "state" for the interface. Also similar to #333 this feels very trivial and edge case, but because there are several issues like this, it makes users feel like they might be losing their mind when they are trying to debug builds 😹 .

Output

No response

Versions and dependencies used.

No response

Anything else?

No response

kcpevey commented 9 months ago

Adding the investigation label since I just realized this deployment is using an older version of the UI. I'll need to retest this on a new deployment.

trallard commented 9 months ago

@kcpevey did you manage to confirm repro of this issue?

kcpevey commented 9 months ago

I was waiting for a deployment to test on since I moved machines, I dont have it set up locally. I'll either have to get this set up locally or wait for our internal deployment to include the latest conda-store release. I won't have time for a local setup this week, but I can check back next week.

kcpevey commented 7 months ago

This is still happening in 2024.1.1rc. Its definitely not behaving properly.

gabalafou commented 5 months ago

As I see it, the underlying issue for both #333 and this issue is that the front-end's global (Redux) store does not really support multiple forms open at the same time. If I had to guess, I would guess that the tabs functionality (i.e., being able to open multiple environments at once across different tabs) was added to the front-end app later. (However, a cursory glance at the git history does not seem to support this guess. Compare the PageTabs commit history with SpecificationEdit commit history, for example.)

In other words, the state object looks roughly like this:

type GlobalState = {
  tabs: {
    // The environments which have been opened (they each have their own tab)
    selectedEnvironments: Environment[]; 
    // The environment in the active tab
    selectedEnvironment: Environment || null;
  };
  // The list of channels for the currently selected environment.
  // This list gets updated as the user edits the form, and it 
  // gets completely replaced each time the user switches tabs.
  channels: string[];
};

This means that we store info like the environment name for each tab, but we only have one place where we store the form data for each tab, so each time a tab is switched, it loads that space with new data for the active tab, obliterating whatever the state was for the previously open tab.

So what we need is something like a dictionary of edits keyed by environment id:

type GlobalState = {
  tabs: { /* ... */ };
  environmentForms: {
    [envId: string]: {
      channels: string[];
    }
  };
};
gabalafou commented 3 weeks ago

Did https://github.com/conda-incubator/conda-store-ui/pull/389 fix this?