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 app configuration frame embedding #1172

Merged
merged 2 commits into from
Jun 21, 2021
Merged

Conversation

dominik-zeglen
Copy link
Contributor

I want to merge this change because it fixes problems with iframe scripts embedding - it currently handles cases when configuration page has no <script /> tags at all or when they don't have src property. Also fixes relative path handling.

PR intended to be tested with API branch: master

Pull Request Checklist

  1. This code contains UI changes
  2. All visible strings are translated with proper context including data-formatting
  3. Attributes [data-test-id] are added for new elements
  4. Changes are mentioned in the changelog
  5. The changes are tested in different browsers and in light/dark mode

Test environment config

API_URI=https://qa.staging.saleor.cloud/graphql/

@dominik-zeglen dominik-zeglen requested review from a team, kamilpastuszka and SektorDV and removed request for a team June 17, 2021 13:50
@github-actions github-actions bot temporarily deployed to fix-app-config-embedding June 17, 2021 13:50 Inactive
@github-actions github-actions bot temporarily deployed to storybook fix-app-config-embedding June 17, 2021 13:50 Inactive
};
}

async function _fetchAndSetContent(
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 think we need to prefix this with _ as we're not exporting it anywhere

}

async function _fetchAndSetContent(
frameContainer: MutableRefObject<HTMLDivElement>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's pass the object reference itself without any React logic

Suggested change
frameContainer: MutableRefObject<HTMLDivElement>,
frameContainer: HTMLDivElement,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not so sure if it would work, this object has to be mutable. Ill test it tomorrow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suprisingly it works

const frameContainer = useRef<HTMLDivElement>(null);

useEffect(() => {
_fetchAndSetContent(frameContainer, data, backendHost, callbacks);
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
_fetchAndSetContent(frameContainer, data, backendHost, callbacks);
_fetchAndSetContent(frameContainer.current, data, backendHost, callbacks);

@dominik-zeglen dominik-zeglen merged commit c8d7edf into master Jun 21, 2021
@dominik-zeglen dominik-zeglen deleted the fix-app-config-embedding branch June 21, 2021 10:55
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.

5 participants