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

Refactor lifecycle module names #8708

Merged
merged 9 commits into from
Jun 27, 2024
Merged

Refactor lifecycle module names #8708

merged 9 commits into from
Jun 27, 2024

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Jun 27, 2024

What does this PR do?

  • Refactors naming in the lifecycle file and related content script messenger API
  • Changes:
    • Extension Point -> Starter Brick
    • Extension -> Mod Component
    • Editor -> Draft
    • Persisted -> Activated
    • "tab" -> "frame" to clarify lifecycle runs in the context of a single frame
    • Use "install"/"run" terminology to match terminology in the Starter Brick interface: StarterBrick.install, StarterBrick.runModComponents
    • Use "remove" terminology to match terminology in the Starter Brick interface: StarterBrick.removeModComponent

Future

  • For the PR, I erred on the side of naming consistency. There's some terminology we'll likely want to clean up in the future in the Starter Brick and lifecycle APIs
    • Move away from "install" terminology, because it can be confused with mod activation. Potential candidates: "mount" (confused with React lifecycle?), "attach", "initialize"
    • Move away from "run" terminology, because for some mod components, e.g., buttons/triggers, "running" the component means attaching it to the page, but the pipeline is not run until a user action/event. Potential candidates: "load", "initialize"
    • Move away from "remove" terminology, because it can be confused with mod deactivation
    • Move away from "reload" terminology, because it can be confused with window.load event terminology
  • Rename the "Reactivate" brick external-facing terminology

For more information on our expectations for the PR process, see the
code review principles doc

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 64.74359% with 55 lines in your changes missing coverage. Please review.

Project coverage is 73.74%. Comparing base (c32e86f) to head (39dd110).
Report is 50 commits behind head on main.

Files Patch % Lines
src/contentScript/lifecycle.ts 61.68% 41 Missing ⚠️
src/background/removeModComponentForEveryTab.ts 66.66% 3 Missing ⚠️
src/contentScript/messenger/api.ts 80.00% 2 Missing ⚠️
...Script/pageEditor/draft/updateDraftModComponent.ts 0.00% 2 Missing ⚠️
src/contentScript/pageEditor/resetTab.ts 0.00% 2 Missing ⚠️
src/bricks/effects/reactivate.ts 50.00% 1 Missing ⚠️
...tensionConsole/pages/brickEditor/useSubmitBrick.ts 50.00% 1 Missing ⚠️
...ionConsole/pages/settings/FactoryResetSettings.tsx 0.00% 1 Missing ⚠️
src/pageEditor/PanelContent.tsx 0.00% 1 Missing ⚠️
...pageEditor/hooks/useUpsertModComponentFormState.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8708      +/-   ##
==========================================
+ Coverage   73.69%   73.74%   +0.05%     
==========================================
  Files        1344     1348       +4     
  Lines       41566    41728     +162     
  Branches     7775     7807      +32     
==========================================
+ Hits        30633    30774     +141     
- Misses      10933    10954      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jun 27, 2024

Playwright test results

passed  80 passed
skipped  2 skipped

Details

report  Open report ↗︎
stats  82 tests across 29 suites
duration  12 minutes, 34 seconds
commit  39dd110

Skipped tests

chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
edge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

@twschiller twschiller changed the title Refactor lifecycle names Refactor lifecycle module names Jun 27, 2024
Copy link
Collaborator

@grahamlangford grahamlangford left a comment

Choose a reason for hiding this comment

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

Looks great. Much easier to reason about with some of these name changes.

For the install/uninstall debate, I'm partial to attach/detach. I've run the concept through ChatGPT for other ideas, but attach still seems to be the best I've seen that's not overloading terms we use elsewhere. The few places we use attach in the existing codebase seem fairly consistent with the behavior we mean when attaching a starter brick

Copy link

No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack.

Do not edit this comment manually.

@twschiller twschiller enabled auto-merge (squash) June 27, 2024 14:06
@twschiller twschiller merged commit d47e205 into main Jun 27, 2024
21 checks passed
@twschiller twschiller deleted the feature/lifecycle-names branch June 27, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants