List of related object after edit/creation may not reflect the real relation on the database

I deployed a fairly simple app with Cuba platform. I had a table Client with related Projects.

1 Client -> Many projects.

I have a page in Generic UI for creating/editing a new client. Inside that page I see the related projects with the possibility to create a new one on the fly.
For some reasons I forgot to make a relation between the two tables in the project edit screen, so the new brand project didn’t have a Client associated. Despite that, I noticed that, returning on the Client Edit screen, the project was added anyway, but it’s a false information. If I save the Client object and re-open the Client editor, the added project is gone (as it should be).

Long story short: I think that javascript took some assumption that a project was added to the list, without re-fetching the data from the database for checking the presence of a relation. I would like, instead, that everytime a list is shown, it could reflect the current state of the database.

This could save me a lot of time and not fall into believing that an object was added correctly because the resulting page was only apparently correct. Furthermore I couldn’t refresh the erroneous result with ‘F5’, I had to close and re-open the Edit screen to see the real state of database.

Hi Michele,

Could you demonstrate the problem on a small test project?

As for refreshing by F5, it doesn’t work because the state of UI resides on the server side and is restored after refreshing the web page in the browser.

Thanks @knstvk, I pushed an example at GitHub - Mizar01/Cuba_TestNestedList

Steps to reproduce:

  1. Create and save 2 Clients (I’ll call them A and B)
  2. Edit Client A → Create Project
  3. On the project Edit window change the pre-selected Client A to B.
  4. Submit the new project.
    5 *** You will see the new project attached to Client A (wrong)
    6 Save the Client A
    7 Reopen Client A for editing
    8 The list of projects doesn’t show anymore the project (right)

*** Expectations: Having changed the association, the project will be associated with B. What will happen: in the db everything is as expected, but the Edit Client A view will show a new project in the list. Only when reloading the client edit view everything is correct.

The same happens if the saving of project is adding something on the fields, or the db has some stored procedures that modify the columns (with OnBeforeInsertEvent for example), the list is not reflecting the real changes in the db.

Hi Michele,

Thank you for reporting the problem. We’ve created an issue.