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

fix: config issues #1041

Merged
merged 1 commit into from
Nov 29, 2024
Merged

fix: config issues #1041

merged 1 commit into from
Nov 29, 2024

Conversation

cazala
Copy link
Member

@cazala cazala commented Nov 29, 2024

This PR fixes two unrelated issues that have been introduced on this commit: cf41aed

  1. The SmartItemBasicView was using a useMemo that was not being called on every render, due to an early return if the entity had no Config component. Hooks need to be called allways on every render to work properly, so this was causing runtime errors. I refactored it to instead of using useHasComponent to return early, it just checks for a null config.

  2. The useHasComponent hook would cache values when switching between different entities. I added an effect to refresh the value if the entity changes. This caused the issue where switching from a smart item to a regular item, it would keep the 'Enable Advanced Mode' option on the dropdown even though the currently selected entity was not a smart item (same for the other way around, going from a non-smart entity to a smart one would cache the value and would not show the 'Enable Advanced Mode' option).

@cazala cazala requested a review from cyaiox November 29, 2024 13:16
@cazala cazala enabled auto-merge (squash) November 29, 2024 13:20
Copy link
Contributor

Test this pull request

  • The @dcl/sdk package can be tested in scenes by running

    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/fix/config-issues/dcl-sdk-7.6.6-12085439994.commit-c4c5e95.tgz"
  • To test with npx init

    export SDK_COMMANDS="https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/fix/config-issues/dcl-sdk-commands-7.6.6-12085439994.commit-c4c5e95.tgz"
    npx $SDK_COMMANDS init
  • The @dcl/inspector package can be tested by visiting this url

    • Or by installing it via NPM
    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/fix/config-issues/@dcl/inspector/dcl-inspector-7.6.6-12085439994.commit-c4c5e95.tgz"
  • The /changerealm command to test test in-world

    /changerealm https://sdk-team-cdn.decentraland.org/ipfs/fix/config-issues-e2e
    
  • You can preview this build entering:
    https://playground.decentraland.org/?sdk-branch=fix/config-issues

@cazala cazala merged commit c62a668 into main Nov 29, 2024
8 checks passed
@cazala cazala deleted the fix/config-issues branch November 29, 2024 13:27
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.

2 participants