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

Switch settings sections and form elements to created lifecycle hook #5224

Merged

Conversation

absidue
Copy link
Member

@absidue absidue commented Jun 3, 2024

Switch settings sections and form elements to created lifecycle hook

Pull Request Type

  • Performance improvement

Related issue

Part of Development Chore: Performance: Switch from mounted to created hook, where possible to avoid unnecessary component updates

Description

The mounted lifecycle hook is triggered after the component has been rendered and has been added to the DOM, the created lifecycle hook is after the component instance has been created, so props and computed properties can be accessed as well as the watchers being active. So to set the default value of a form element for example, we want to use the created lifecycle hook, as setting that in the mounted hook will trigger a re-render and changes to the DOM.

There are of course exceptions, if you want to show a loading symbol, then fetching the data and setting values in the mounted hook is a great idea, because then the user will see the loading icon while your stuff is running.

Testing

  1. Open the settings
  2. Check that the text inputs, switches and sliders are showing the correct values.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 0.20.0

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 3, 2024 17:22
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jun 3, 2024
@FreeTubeBot FreeTubeBot merged commit aaea23b into FreeTubeApp:development Jun 4, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jun 4, 2024
@absidue absidue deleted the created-forms-settings branch June 4, 2024 09:06
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Jun 5, 2024
* development:
  Translated using Weblate (Italian)
  Translated using Weblate (Chinese (Traditional))
  Translated using Weblate (Chinese (Simplified))
  Translated using Weblate (French)
  Translated using Weblate (Spanish)
  Translated using Weblate (Portuguese (Brazil))
  Translated using Weblate (Spanish)
  Make adding duplicate disabled by default (FreeTubeApp#5044)
  Switch settings sections and form elements to created lifecycle hook (FreeTubeApp#5224)
  Translated using Weblate (French)
  Translated using Weblate (Estonian)
  Bump sass from 1.77.2 to 1.77.4 (FreeTubeApp#5222)
  Bump lefthook from 1.6.13 to 1.6.15 (FreeTubeApp#5223)
  Bump the eslint group with 2 updates (FreeTubeApp#5218)
  Bump electron from 30.0.8 to 30.0.9 (FreeTubeApp#5221)
  Bump swiper from 11.1.3 to 11.1.4 (FreeTubeApp#5220)
  Bump stylelint from 16.6.0 to 16.6.1 in the stylelint group (FreeTubeApp#5219)
  Add missing IPC channel constants (FreeTubeApp#5216)
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Jun 5, 2024
* feature/subscription-cache:
  ! Rename subscriptions to subscription cache & fix outdated mutation reference
  Translated using Weblate (Italian)
  Translated using Weblate (Chinese (Traditional))
  Translated using Weblate (Chinese (Simplified))
  Translated using Weblate (French)
  Translated using Weblate (Spanish)
  Translated using Weblate (Portuguese (Brazil))
  Translated using Weblate (Spanish)
  Make adding duplicate disabled by default (FreeTubeApp#5044)
  Switch settings sections and form elements to created lifecycle hook (FreeTubeApp#5224)
  Translated using Weblate (French)
  Translated using Weblate (Estonian)
  Bump sass from 1.77.2 to 1.77.4 (FreeTubeApp#5222)
  Bump lefthook from 1.6.13 to 1.6.15 (FreeTubeApp#5223)
  Bump the eslint group with 2 updates (FreeTubeApp#5218)
  Bump electron from 30.0.8 to 30.0.9 (FreeTubeApp#5221)
  Bump swiper from 11.1.3 to 11.1.4 (FreeTubeApp#5220)
  Bump stylelint from 16.6.0 to 16.6.1 in the stylelint group (FreeTubeApp#5219)
  Add missing IPC channel constants (FreeTubeApp#5216)
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.

5 participants