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

Redundant query on public / embedded question page with default filters #17061

Open
kulyk opened this issue Jul 15, 2021 · 3 comments
Open

Redundant query on public / embedded question page with default filters #17061

kulyk opened this issue Jul 15, 2021 · 3 comments
Labels
Embedding/Public Simple public iframe embeds Embedding/Static Static embedding, previously known as signed embedding .Frontend .Performance Priority:P2 Average run of the mill bug Querying/Parameters & Variables Filter widgets, field filters, variables etc. .Team/Embedding Type:Bug Product defects

Comments

@kulyk
Copy link
Member

kulyk commented Jul 15, 2021

When opening a public question page that has filters with default values, the app performs two queries instead of one. It's happening because of a current filter values lifecycle. The first query is done without any filters, then filters receive default values, and another request is made. Moreover, it slows down the time until people can see the relevant results.

A possible solution would be to move the logic retrieving/syncing filter default values to the upper level (e.g. PublicQuestion), so the initial query contains default filter parameters. It's currently done by syncQueryParamsWithURL at Parameters

More details here: #17034

Query and parameters lifecycle

From #17034

  1. You open a URL like /public/question/:guid. There are no query parameters that are usually in sync with filters. So when the page mounts
  2. PublicQuestion mounts
  3. The query run is triggered inside UNSAFE_componentWillMount without parameters
  4. PublicQuestion renders EmbedFrame, EmbedFrame renders Parameters
  5. Parameters start syncing parameters with query parameters. At the end, it should take parameters' default values and append them to the URL as query parameters
  6. Parameters trigger the setParameterValue call, so the URL can be updated and we can run the query. setParameterQuery triggers a new query run, now with default parameters applied
  7. The trick is steps 3-6 happen simultaneously, and sometimes (however I can reproduce that every time), the result without filters is applied later, and you can see an error

125622992-71487829-9213-4815-bffd-bd4d8d93326a

@kulyk kulyk added the Type:Tech Debt or Refactoring label Jul 15, 2021
@kulyk kulyk added Embedding/Public Simple public iframe embeds Embedding/Static Static embedding, previously known as signed embedding Querying/Parameters & Variables Filter widgets, field filters, variables etc. labels Jul 15, 2021
@flamber flamber added Priority:P2 Average run of the mill bug Type:Bug Product defects .Performance and removed Type:Tech Debt or Refactoring labels Jul 15, 2021
@flamber

This comment was marked as outdated.

@nemanjaglumac

This comment was marked as outdated.

@kulyk

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Embedding/Public Simple public iframe embeds Embedding/Static Static embedding, previously known as signed embedding .Frontend .Performance Priority:P2 Average run of the mill bug Querying/Parameters & Variables Filter widgets, field filters, variables etc. .Team/Embedding Type:Bug Product defects
Projects
None yet
Development

No branches or pull requests

4 participants