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

Replace EditorEvents with Hookstate #5348

Merged
merged 40 commits into from
Mar 2, 2022
Merged

Replace EditorEvents with Hookstate #5348

merged 40 commits into from
Mar 2, 2022

Conversation

zulqarnainhanif
Copy link
Contributor

@zulqarnainhanif zulqarnainhanif commented Feb 26, 2022

Summary

  • Replace all the editor events with hookstate

Checklist

  • Pre-push checks pass npm run check
    • Linter passing via npm run lint
    • Unit & Integration tests passing via npm run test:packages
    • Docker build process passing via npm run build-client
  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

References

#4340

QA Steps

  1. git checkout pr_branch_name
  2. npm install
  3. npm run dev-reinit
  4. npm run dev

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Reviewers

@HexaField

@zulqarnainhanif zulqarnainhanif linked an issue Feb 26, 2022 that may be closed by this pull request
Copy link
Contributor

@NPatel10 NPatel10 left a comment

Choose a reason for hiding this comment

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

Everything looks good. At one place I like to draw your attention. Let me know your thought on that

@zulqarnainhanif
Copy link
Contributor Author

zulqarnainhanif commented Mar 1, 2022

@NPatel10 @HexaField 2 issues left in this PR which i will be working at night.

  • Hierarchy Tree isn't updating and showing (once you expand its view it shows up)
  • Loading another scene over current scene creates the same problem we were facing before (might be some problem with scene not being unloaded properly etc)

@zulqarnainhanif zulqarnainhanif marked this pull request as ready for review March 2, 2022 08:37
@speigg
Copy link
Member

speigg commented Mar 2, 2022

One more thing; I added useHookedEffect(), which should be used for creating effects with hookstate deps. The issue being that you don't want to pass state.value as a dep if state.value refers to an object (rather than a primitive). Passing state as a dep is correct, but if state.value is never used in the component, then hookstate dependency tracking won't cause that component to rerender when that state changes. useHookEffect() fixes this.

@zulqarnainhanif
Copy link
Contributor Author

One more thing; I added useHookedEffect(), which should be used for creating effects with hookstate deps. The issue being that you don't want to pass state.value as a dep if state.value refers to an object (rather than a primitive). Passing state as a dep is correct, but if state.value is never used in the component, then hookstate dependency tracking won't cause that component to rerender when that state changes. useHookEffect() fixes this.

@speigg Can you please point out with an example if such changes needs to be done in my PR.

@speigg
Copy link
Member

speigg commented Mar 2, 2022

@zulqarnainhanif In EditorContainer.ts, you added

  useEffect(() => {
     if (editorError) {
       onEditorError(editorError.value)
     }
   }, [editorError])

This should be useHookedEffect, otherwise the component won't re-render when the editorError state changes. This is the only case where it's strictly necessary in this PR, but it doesn't hurt to use useHookedEffect everywhere by default (especially if using hookstate deps), and will prevent potential bugs in the future.

@speigg speigg merged commit c5562c3 into dev Mar 2, 2022
@HexaField HexaField deleted the RemoveEditorEvents branch March 2, 2022 21:57
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.

Replace EditorEvents with Hookstate
3 participants