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

#9007 Cleanup mods page & remove standalone mod components #9040

Merged
merged 41 commits into from
Aug 22, 2024

Conversation

BLoe
Copy link
Contributor

@BLoe BLoe commented Aug 21, 2024

What does this PR do?

Demo

  • Paste a screenshot or demo video here

Remaining Work

  • Add new files to strict null checks
  • Fix/refactor e2e tests

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

@BLoe BLoe self-assigned this Aug 21, 2024
@twschiller twschiller added this to the 2.1.1 milestone Aug 21, 2024
@@ -34,45 +34,61 @@ export type UnavailableMod = Pick<
};

// XXX: should this be SerializedModComponent instead of HydratedModComponent? The old screens used ResolvedModComponent
export type Mod = ModDefinition | HydratedModComponent | UnavailableMod;
export type Mod = ModDefinition | UnavailableMod;
Copy link
Contributor

@twschiller twschiller Aug 21, 2024

Choose a reason for hiding this comment

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

Reviewer note: this is the main type change that drops standalone mods

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 81.91781% with 66 lines in your changes missing coverage. Please review.

Project coverage is 74.37%. Comparing base (8318d74) to head (0f47f7c).
Report is 222 commits behind head on main.

Files Patch % Lines
...nsionConsole/pages/mods/utils/buildModViewItems.ts 21.87% 25 Missing ⚠️
src/extensionConsole/pages/mods/ModsPage.tsx 40.00% 9 Missing ⚠️
src/modDefinitions/modDefinitionsSlice.ts 82.05% 7 Missing ⚠️
src/extensionConsole/pages/mods/Status.tsx 70.00% 6 Missing ⚠️
...rc/extensionConsole/pages/mods/ModsPageSidebar.tsx 0.00% 3 Missing ⚠️
...c/extensionConsole/pages/mods/modsPageSelectors.ts 90.62% 3 Missing ⚠️
...xtensionConsole/pages/mods/ModsPageTableLayout.tsx 75.00% 2 Missing ⚠️
.../extensionConsole/pages/mods/gridView/GridCard.tsx 50.00% 2 Missing ⚠️
.../extensionConsole/pages/mods/gridView/GridView.tsx 0.00% 2 Missing ⚠️
.../extensionConsole/pages/mods/listView/ListItem.tsx 50.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9040      +/-   ##
==========================================
+ Coverage   74.24%   74.37%   +0.12%     
==========================================
  Files        1332     1342      +10     
  Lines       40817    41516     +699     
  Branches     7634     7723      +89     
==========================================
+ Hits        30306    30878     +572     
- Misses      10511    10638     +127     

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

Copy link

github-actions bot commented Aug 21, 2024

Playwright test results

passed  122 passed
flaky  4 flaky
skipped  6 skipped

Details

report  Open report ↗︎
stats  132 tests across 44 suites
duration  11 minutes, 31 seconds
commit  0f47f7c
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/modLifecycle.spec.ts › create, run, package, and update mod
chrome › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/regressions/welcomeStarterBricks.spec.ts › #8740: can view the starter mods on the pixiebrix.com/welcome page

Skipped tests

chrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
msedge › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
chrome › tests/runtime/insertAtCursor.spec.ts › Insert at Cursor › 8154: can insert at cursor after opening sidebar from selection menu
msedge › tests/runtime/insertAtCursor.spec.ts › Insert at Cursor › 8154: can insert at cursor after opening sidebar from selection menu

import { isUnavailableMod } from "@/utils/modUtils";
import * as semver from "semver";

export default function buildGetModVersionStatus(
Copy link
Contributor

@twschiller twschiller Aug 22, 2024

Choose a reason for hiding this comment

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

FWIW, IMO these kinds of method can just be defined as normal function taking the activated mod components and the mod and parameters. To get the method that just takes the just the mod you can use lodash partial or just plain JS

const getX = partial(getModVersionStatus, mods);
const getX = foo((x: Mod) => getModVersionStatus(mods, x))

Of course, the lift to write getModVersionStatus(activatedModComponents)(x) isn't large either. So this is more of a stylistic opinion

Comment on lines 59 to +62
export const selectModHasAnyActivatedModComponents =
(modId?: RegistryId) =>
(state: ModComponentsRootState): boolean =>
Boolean(
modId && !isEmpty(activatedModComponentsForModSelector(state, modId)),
);
Boolean(modId && !isEmpty(selectGetModComponentsForMod(state)(modId)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: should we go ahead and convert this to use reselect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's only called once with the modId on the activate mod page, so I don't think there are really any perf concerns here right now

// Re-render the list when expandedRows changes.
useEffect(() => {
setListKey(uuidv4());
listRef.current?.resetAfterIndex(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

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
Copy link
Contributor

@BLoe see conflicts - @grahamlangford's PR renamed some things

@BLoe BLoe merged commit 12ff6ef into main Aug 22, 2024
23 checks passed
@BLoe BLoe deleted the feature/9007-cleanup-mods-page branch August 22, 2024 20:55
@grahamlangford grahamlangford modified the milestones: 2.1.2, 2.1.1 Aug 27, 2024
grahamlangford added a commit that referenced this pull request Aug 27, 2024
* convert view items to selectors

* fix grid/list items and marketplace url

* convert the actions and add packageId to viewmodel

* fix other mod icon usages and cleanup null checks file errors

* fix more errors and add mod action tests

* buildModsList and tests

* buildGetModStatus and tests

* buildGetModVersionStatus and tests and fix names

* buildGetModSharingSource and tests

* buildCanEditModScope and tests

* buildModViewItems

* add more cases to build mods list tests and remove old tests

* fix mod slice tests

* Status tests

* fix some bugs and table layout tests

* fix tests and snapshots

* handle feature flags update

* fix types

* tweak name

* fix dead code

* null checks - ModsPageActions.test

* fix null checks issues

* cleanup

* cleanup

* add files to strict null checks

* assert not null on _recipe property

* uninstall unused package

* auto-add strictNullChecks

* memoize selector

* memoize query input and refetch another query on load

* memoize selector

* fix memoization of mod component selector

* revert memo change and add file to null checks

* fix workshop action

* reset the list properly

* fix test

* fix ref type

* fix ref again

---------

Co-authored-by: Ben Loe <ben@pixiebrix.com>
Co-authored-by: Graham Langford <grahamlangford87@gmail.com>
grahamlangford added a commit that referenced this pull request Aug 27, 2024
* Bump @types/webextension-polyfill from 0.10.7 to 0.12.0

Bumps [@types/webextension-polyfill](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webextension-polyfill) from 0.10.7 to 0.12.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webextension-polyfill)

---
updated-dependencies:
- dependency-name: "@types/webextension-polyfill"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* type fixes

* sidebarSlice.test.ts

* editorStorage.test.ts

* checkAvailableActivatedModComponents.test.ts

* starterBrickModUtils.test.ts

* Tabs.test.tsx

* ActivatedModPanel.test.tsx

* TriggerConfiguration.test.tsx

* more files

* editorSliceHelpers.test.ts

* more files

* more strict null checks

* Revert "more strict null checks"

This reverts commit e34f806.

* Revert "more files"

This reverts commit 92a618c.

* Revert "editorSliceHelpers.test.ts"

This reverts commit 3aa28c1.

* Revert "more files"

This reverts commit 233139b.

* Revert "TriggerConfiguration.test.tsx"

This reverts commit 60bc4d4.

* Revert "ActivatedModPanel.test.tsx"

This reverts commit 8d57036.

* Revert "Tabs.test.tsx"

This reverts commit f42bfed.

* Revert "starterBrickModUtils.test.ts"

This reverts commit 10e9530.

* Revert "checkAvailableActivatedModComponents.test.ts"

This reverts commit cc6e646.

* Revert "editorStorage.test.ts"

This reverts commit 8366437.

* Revert "sidebarSlice.test.ts"

This reverts commit 256a7ac.

* Strict null checks: 95.7% (#9030)

* Revert "Revert "sidebarSlice.test.ts""

This reverts commit 274ab05.

* Revert "Revert "editorStorage.test.ts""

This reverts commit 01663a4.

* Revert "Revert "checkAvailableActivatedModComponents.test.ts""

This reverts commit 2e09285.

* Revert "Revert "starterBrickModUtils.test.ts""

This reverts commit 6a56169.

* Revert "Revert "Tabs.test.tsx""

This reverts commit db37bcf.

* Revert "Revert "ActivatedModPanel.test.tsx""

This reverts commit b9299a3.

* Revert "Revert "TriggerConfiguration.test.tsx""

This reverts commit 3357d9a.

* Revert "Revert "more files""

This reverts commit 1b2fe11.

* Revert "Revert "editorSliceHelpers.test.ts""

This reverts commit f88df33.

* Revert "Revert "more files""

This reverts commit 5eb9e61.

* Revert "Revert "more strict null checks""

This reverts commit c810d26.

* Introduce milestones constant (#9032)

* #9015: improve sidebar diagnostics telemetry (#9033)

* fix integration dependency validation in the extension console (#9036)

* fix integration dependency validation in the extension console

* select integration option during activation flow

* Revert "Bump iframe-resizer from 4.4.5 to 5.2.4 (#9023)" (#9035)

This reverts commit 4e8536d.

* Strict null checks -- 98.0% (#9038)

* saveHelpers.test.ts

* more files

* more files

* more files

* more fixes

* update snapshot

* #9014: race condition waiting for welcome mods to be activated on first run (#9042)

* starterMods -> welcomeMods

* give more context when welcome mod activation doesn't activate any mods

* remove unneeded comment; export ActivateModsResult

* review changes

* rename starterMods.ts -> welcomeMods.ts

* more renaming

* update naming for ActivatedModsResult

* update naming for ActivatedModsResult

* convert comments to jsdoc hints

* #9007 Cleanup mods page & remove standalone mod components (#9040)

* convert view items to selectors

* fix grid/list items and marketplace url

* convert the actions and add packageId to viewmodel

* fix other mod icon usages and cleanup null checks file errors

* fix more errors and add mod action tests

* buildModsList and tests

* buildGetModStatus and tests

* buildGetModVersionStatus and tests and fix names

* buildGetModSharingSource and tests

* buildCanEditModScope and tests

* buildModViewItems

* add more cases to build mods list tests and remove old tests

* fix mod slice tests

* Status tests

* fix some bugs and table layout tests

* fix tests and snapshots

* handle feature flags update

* fix types

* tweak name

* fix dead code

* null checks - ModsPageActions.test

* fix null checks issues

* cleanup

* cleanup

* add files to strict null checks

* assert not null on _recipe property

* uninstall unused package

* auto-add strictNullChecks

* memoize selector

* memoize query input and refetch another query on load

* memoize selector

* fix memoization of mod component selector

* revert memo change and add file to null checks

* fix workshop action

* reset the list properly

* fix test

* fix ref type

* fix ref again

---------

Co-authored-by: Ben Loe <ben@pixiebrix.com>
Co-authored-by: Graham Langford <grahamlangford87@gmail.com>

* Fix bug with form state migration (#9045)

* copy form state on migrate

* fix bug and add tests

* add test file to null checks

* fix word

---------

Co-authored-by: Ben Loe <ben@pixiebrix.com>

* Strict null checks -- 99.7% (#9048)

* adds files

* pr change

* swap order in if

* Bump the patch group with 4 updates (#9051)

Bumps the patch group with 4 updates: [@swc/core](https://github.com/swc-project/swc), [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip), [otpauth](https://github.com/hectorm/otpauth) and [sass-loader](https://github.com/webpack-contrib/sass-loader).


Updates `@swc/core` from 1.7.11 to 1.7.18
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](swc-project/swc@v1.7.11...v1.7.18)

Updates `knip` from 5.27.2 to 5.27.3
- [Release notes](https://github.com/webpro-nl/knip/releases)
- [Changelog](https://github.com/webpro-nl/knip/blob/main/packages/knip/.release-it.json)
- [Commits](https://github.com/webpro-nl/knip/commits/5.27.3/packages/knip)

Updates `otpauth` from 9.3.1 to 9.3.2
- [Release notes](https://github.com/hectorm/otpauth/releases)
- [Commits](hectorm/otpauth@v9.3.1...v9.3.2)

Updates `sass-loader` from 16.0.0 to 16.0.1
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](webpack-contrib/sass-loader@v16.0.0...v16.0.1)

---
updated-dependencies:
- dependency-name: "@swc/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: knip
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: otpauth
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: sass-loader
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @testing-library/jest-dom from 6.4.8 to 6.5.0 (#9055)

Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 6.4.8 to 6.5.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](testing-library/jest-dom@v6.4.8...v6.5.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @types/node from 22.4.0 to 22.5.0 (#9053)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.4.0 to 22.5.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* #9039: restrict public marketplace activation (#9063)

* Bump ace-builds from 1.35.4 to 1.36.0 (#9059)

Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.35.4 to 1.36.0.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](ajaxorg/ace-builds@v1.35.4...v1.36.0)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump tj-actions/changed-files from 44 to 45 (#9050)

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 44 to 45.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v44...v45)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump webpack from 5.91.0 to 5.94.0 (#9054)

Bumps [webpack](https://github.com/webpack/webpack) from 5.91.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.91.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @cfworker/json-schema from 1.12.8 to 2.0.1 (#9061)

Bumps [@cfworker/json-schema](https://github.com/cfworker/cfworker) from 1.12.8 to 2.0.1.
- [Release notes](https://github.com/cfworker/cfworker/releases)
- [Commits](https://github.com/cfworker/cfworker/compare/@cfworker/json-schema@1.12.8...@cfworker/json-schema@2.0.1)

---
updated-dependencies:
- dependency-name: "@cfworker/json-schema"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bug - Fix redux persist migrations for sidebar state, related to welcome mod activation (#9067)

* fix migrate max version function

* update test

---------

Co-authored-by: Ben Loe <ben@pixiebrix.com>

* Strict Null Checks Final (#9049)

* adds files

* wip

* enforce strict null checks for all files

* lint fixes

* handle bad comment

* pr review changes

* missed file save

* Bump @sinonjs/fake-timers from 11.2.2 to 13.0.1 (#9066)

Bumps [@sinonjs/fake-timers](https://github.com/sinonjs/fake-timers) from 11.2.2 to 13.0.1.
- [Release notes](https://github.com/sinonjs/fake-timers/releases)
- [Changelog](https://github.com/sinonjs/fake-timers/blob/main/CHANGELOG.md)
- [Commits](sinonjs/fake-timers@v11.2.2...v13.0.1)

---
updated-dependencies:
- dependency-name: "@sinonjs/fake-timers"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @axe-core/playwright from 4.9.1 to 4.10.0 (#9052)

Bumps [@axe-core/playwright](https://github.com/dequelabs/axe-core-npm) from 4.9.1 to 4.10.0.
- [Release notes](https://github.com/dequelabs/axe-core-npm/releases)
- [Changelog](https://github.com/dequelabs/axe-core-npm/blob/v4.10.0/CHANGELOG.md)
- [Commits](dequelabs/axe-core-npm@v4.9.1...v4.10.0)

---
updated-dependencies:
- dependency-name: "@axe-core/playwright"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @total-typescript/ts-reset from 0.5.1 to 0.6.0 (#9057)

* Bump @total-typescript/ts-reset from 0.5.1 to 0.6.0

Bumps [@total-typescript/ts-reset](https://github.com/total-typescript/ts-reset) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/total-typescript/ts-reset/releases)
- [Changelog](https://github.com/mattpocock/ts-reset/blob/main/CHANGELOG.md)
- [Commits](https://github.com/total-typescript/ts-reset/commits)

---
updated-dependencies:
- dependency-name: "@total-typescript/ts-reset"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix Map typings

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Graham Langford <grahamlangford87@gmail.com>

* fix typings

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Graham Langford <grahamlangford87@gmail.com>
Co-authored-by: Graham Langford <30706330+grahamlangford@users.noreply.github.com>
Co-authored-by: Todd Schiller <todd.schiller@gmail.com>
Co-authored-by: Ben Loe <below413@gmail.com>
Co-authored-by: Ben Loe <ben@pixiebrix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop support for standalone mod components - Slice 3 - Cleanup standalone component code in extension console
3 participants