Skip to content

feat/AB#80252_Allow-frontend-to-reload-when-admin-updates/create-a-form #2184

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

Open
wants to merge 6 commits into
base: beta
Choose a base branch
from

Conversation

GuilhermeGabriel
Copy link
Contributor

@GuilhermeGabriel GuilhermeGabriel commented Dec 16, 2023

Description

One issue we usually face while configuring forms/resources is that the system will stop working as expected after saving forms/resources. Indeed, the back-end needs to reload, and the front does not get the changes. We should, if possible, either reload the entire front, either reload the graphql.

Useful links

  • Please insert link to ticket: (I don't have access)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (refactor or addition to existing functionality)

How Has This Been Tested?

Create a new form, add a field to it, and test if the field appears in the layout editor without reloading the page.

Screenshots

output.mp4

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-frontend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

@GuilhermeGabriel GuilhermeGabriel added bug Something isn't working enhancement New feature or request labels Dec 16, 2023
@GuilhermeGabriel GuilhermeGabriel self-assigned this Dec 16, 2023
@@ -202,6 +202,7 @@ export class AddPageComponent extends UnsubscribeComponent implements OnInit {
);

this.onSubmit();
window.location.reload();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@GuilhermeGabriel
that won't work
you need to wait for the server to be ready again to do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I tried a new approach!

@GuilhermeGabriel GuilhermeGabriel marked this pull request as ready for review December 19, 2023 10:41
@@ -38,3 +38,121 @@ export const GET_SHORT_FORM_BY_ID = gql`
}
}
`;

/** Graphql request for getting query types */
export const GET_QUERY_TYPES = gql`
Copy link
Collaborator

Choose a reason for hiding this comment

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

@GuilhermeGabriel
I don't like this approach
you're duplicating a query we already see in another service, for a call that will be done only once, so for me it doesn't make sense

you should prefer, for example, build a subject in the query-builder, and, when you detect a change in the subject, you refetch the data

so you can, in the form builder service, just emit an event to the query builder service

Copy link
Collaborator

Choose a reason for hiding this comment

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

@AntoineRelief do you think a websocket solution would be overkill?

@AntoineRelief AntoineRelief marked this pull request as draft December 19, 2023 11:34
@GuilhermeGabriel GuilhermeGabriel marked this pull request as ready for review December 19, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants