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

#8607 More replacing element -> modComponentFormState #8706

Merged
merged 25 commits into from
Jun 27, 2024

Conversation

mnholtz
Copy link
Collaborator

@mnholtz mnholtz commented Jun 27, 2024

What does this PR do?

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 81.91489% with 17 lines in your changes missing coverage. Please review.

Project coverage is 73.64%. Comparing base (c32e86f) to head (9ae92f4).
Report is 51 commits behind head on main.

Files Patch % Lines
src/pageEditor/hooks/useResetRecipe.ts 0.00% 6 Missing ⚠️
...pageEditor/hooks/useUpsertModComponentFormState.ts 69.23% 4 Missing ⚠️
src/pageEditor/toolbar/ReloadToolbar.tsx 77.77% 4 Missing ⚠️
src/pageEditor/analysisManager.ts 60.00% 2 Missing ⚠️
.../pageEditor/hooks/useSaveStandaloneModComponent.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8706      +/-   ##
==========================================
- Coverage   73.69%   73.64%   -0.06%     
==========================================
  Files        1344     1346       +2     
  Lines       41566    41604      +38     
  Branches     7775     7797      +22     
==========================================
+ Hits        30633    30638       +5     
- Misses      10933    10966      +33     

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

@@ -23,14 +23,14 @@ import { useDispatch, useSelector } from "react-redux";
import useResetExtension from "@/pageEditor/hooks/useResetExtension";
import { selectModComponentFormStates } from "@/pageEditor/slices/editorSelectors";

function useResetRecipe(): (recipeId: RegistryId) => Promise<void> {
function useResetRecipe(): (modId: RegistryId) => Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we go ahead and rename this hook as well? I don't think it's used in very many places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changing recipe -> mod is sort of out of scope. I stopped myself here because I realized that the renaming could easily spiral if I kept following the thread of getting all "recipe" occurrences. We have a ticket for getting rid of recipe in the Page Editor

.... or at least I thought we did? I might have to open an additional ticket to #8579

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made a ticket here: #8710

cc @grahamlangford

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  11 minutes, 37 seconds
commit  9ae92f4

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

*/
export function selectNodePreviewActiveElement(
export function selectActiveDocumentOrFormPreviewElement(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love the "DocumentOrFormPreviewElement" term and wonder if we can figure out something simpler, like "DOMElement" or something, but probably not worth considering in this PR 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't either, but unless we combine the concepts of "DocumentBuilder" and "FormBuilder" I can't think of an alternative that communicates the same thing to this effect.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't either, but unless we combine the concepts of "DocumentBuilder" and "FormBuilder" I can't think of an alternative that communicates the same thing to this effect.

Would BuilderElement work? That would capture both

We don't have any near-term plans to combine the document builder and form builder

Copy link
Collaborator Author

@mnholtz mnholtz Jun 27, 2024

Choose a reason for hiding this comment

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

Would BuilderElement work?

Maybe just PreviewElement in that case? e.g. just selectActivePreviewElement This particular piece of data is in reference to the preview specifically.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just PreviewElement in that case? e.g. just selectActivePreviewElement This particular piece of data is in reference to the preview specifically.

Yeah that works for me if you're confident it's also an appropriate name here, I would say just go with your best judgement 🤷‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would you mind if I opened up a separate PR to revert this? Past PRs introduced this naming pattern and theres a lot of places I use DocumentOrFormPreviewElement

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a comment to this ticket #8609 to address this issue

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah totally cool to be a separate PR 👍

Comment on lines 81 to 82
isAutomaticTrigger(modComponentFormState) || // By default, don't automatically trigger (because it might be doing expensive operations such as hitting an API)
isPanel(modComponentFormState) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
isAutomaticTrigger(modComponentFormState) || // By default, don't automatically trigger (because it might be doing expensive operations such as hitting an API)
isPanel(modComponentFormState) ||
isAutomaticTrigger(modComponentFormState) ||
// By default, don't automatically trigger (because it might be doing expensive operations such as hitting an API)
isPanel(modComponentFormState) ||

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why put the comment underneath isAutomaticTrigger?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I put it inline because prettier adds gross extra parenthesis when I put it on the line above isAutomaticTrigger

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks to me like in the previous code before your PR, this comment was meant for the isPanel line and not the isAutomaticTrigger line?
https://github.com/pixiebrix/pixiebrix-extension/blob/main/src/pageEditor/toolbar/ReloadToolbar.tsx#L72-L75

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, I think the comment is referring to how we check for !isPanel() when deciding whether to "auto update".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks to me like in the previous code before your PR, this comment was meant for the isPanel line and not the isAutomaticTrigger line?

Oh, it looks like I got confused by the "automatic trigger" terms in the comment

Copy link
Collaborator

Choose a reason for hiding this comment

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

💜

Copy link
Collaborator

Choose a reason for hiding this comment

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

💜

# Conflicts:
#	src/pageEditor/hooks/useSaveMod.ts
Copy link
Contributor

@BLoe BLoe left a comment

Choose a reason for hiding this comment

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

Nothing blocking in the remaining threads for me 👍

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.

@mnholtz mnholtz enabled auto-merge (squash) June 27, 2024 17:11
@mnholtz mnholtz merged commit bd3d9c5 into main Jun 27, 2024
21 checks passed
@mnholtz mnholtz deleted the feature/8607_slice_5 branch June 27, 2024 17:23
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.

4 participants