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

loadStoryblokBridge does not properly resolve or reject #649

Open
1 task done
addemod opened this issue Jan 30, 2025 · 1 comment
Open
1 task done

loadStoryblokBridge does not properly resolve or reject #649

addemod opened this issue Jan 30, 2025 · 1 comment
Assignees
Labels
p3-significant [Priority] Moderate issues, major enhancements

Comments

@addemod
Copy link

addemod commented Jan 30, 2025

Describe the issue you're facing

When calling loadStoryblokBridge (loadBridge), the promise won't resolve or reject properly in certain cases.
Instead of calling return;, the promise should be resolved or rejected, based on the reason of returning early.

In the first case, if window is undefined, reject() should be called with an error. The second case, where the script tag already exists, the promise should just be resolved by calling resolve().

Should reject:


Should resolve:
return;

Reproduction

https://stackblitz.com/edit/js-gn3awrkt?file=index.js

Steps to reproduce

Check the Stackblitz app. The console logs will never be outputted, after loading the script. The reason for this, in the reproduction, is because the script tag already exists in index.html, which could be a real case.

If any condition in loadBridge forces a return; call, the promise will never resolve.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
    Memory: 8.22 GB / 31.46 GB
  Binaries:
    Node: 20.18.1 - C:\nvm4w\nodejs\node.EXE
    Yarn: 1.22.22 - C:\nvm4w\nodejs\yarn.CMD
    npm: 10.8.2 - C:\nvm4w\nodejs\npm.CMD
    pnpm: 9.15.3 - C:\nvm4w\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.146)

Used Package Manager

pnpm

Error logs (Optional)

No response

Validations

@addemod addemod added pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Jan 30, 2025
@edodusi edodusi self-assigned this Feb 4, 2025
@edodusi edodusi added bug [Issue] Something isn't working and removed pending-author [Issue] Awaiting further information or action from the issue author pending-triage [Issue] Ticket is pending to be prioritised labels Feb 4, 2025
@edodusi
Copy link
Contributor

edodusi commented Feb 4, 2025

Thanks @addemod for reporting this, we will investigate on a fix

@alvarosabu alvarosabu added p3-significant [Priority] Moderate issues, major enhancements p2-nice-to-have [Priority] Lower priority, beneficial enhancements that are not urgent. and removed bug [Issue] Something isn't working p2-nice-to-have [Priority] Lower priority, beneficial enhancements that are not urgent. labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-significant [Priority] Moderate issues, major enhancements
Projects
None yet
Development

No branches or pull requests

3 participants