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

Fix Brand Recommendations animation on second time appearance #1267

Merged
merged 9 commits into from
Sep 12, 2023

Conversation

annacv
Copy link
Contributor

@annacv annacv commented Aug 28, 2023

EMP-1707

Pull request template

Remove all the QueriesPreview from the state when the component is destroyed. This way, we prevent re-rendering effects when we go back to a pre-search scenario after selecting & removing a query from the search box.

There were other two options available to handle this: using v-show instead of v-if, or preventing sending the requests if there were QueryPreviews on the state. These options had the con of losing the DOM animation, so I went for this removing queries approach from the state option in order to keep the current component rendering behavior.

Motivation and context

When writing a query and then deleting it, the BrandRecommendations/QueryPreview component is displayed again, making like two times the appearance animation.

  • Dependencies. If any, specify:
  • Open issue. If applicable, link: EMP-1707

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to not work as expected)
  • Change requires a documentation update

What is the destination branch of this PR?

  • Main
  • Other. Specify:

How has this been tested?

  • Choose a query and delete it, query preview carrousel should be shown at one. The test can be performed by setting a slower Network value in Chrome devTools to be able to check it more accurately.
  • Additionally, the project can be built and tested in archetype using the install-local command with this build: "install:local": "npm install file:../x/packages/x-components/empathyco-x-components-3.0.0-alpha.406.tgz --no-save",

@annacv annacv requested a review from a team as a code owner August 28, 2023 12:24
@annacv annacv closed this Aug 29, 2023
@annacv annacv reopened this Aug 29, 2023
@annacv
Copy link
Contributor Author

annacv commented Aug 30, 2023

Hi @herrardo & @CachedaCodes here is another approach that makes more sense. Updated PR description 👀 . Let me know what you think, please.

@annacv annacv requested a review from CachedaCodes September 7, 2023 14:16
Comment on lines 20 to 23
/**
* The component that shows a Query preview has been destroyed.
*/
QueriesPreviewDestroyedHook: void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this event

@@ -49,6 +47,7 @@
import { createOrigin } from '../../../utils/origin';
import { debounce } from '../../../utils/debounce';
import { DebouncedFunction } from '../../../utils';
import { LIST_ITEMS_KEY, XProvide } from '../../../components';
Copy link
Contributor

Choose a reason for hiding this comment

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

restore this imports as they were before

@annacv annacv requested a review from CachedaCodes September 12, 2023 09:43
@CachedaCodes CachedaCodes merged commit e7141a3 into main Sep 12, 2023
4 checks passed
@CachedaCodes CachedaCodes deleted the bugfix/EMP-1707-Brand-recommendations-wrong-reload branch September 12, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants