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

Frame issue #407

Closed
Sahak885 opened this issue Apr 2, 2024 · 61 comments · Fixed by #413
Closed

Frame issue #407

Sahak885 opened this issue Apr 2, 2024 · 61 comments · Fixed by #413

Comments

@Sahak885
Copy link

Sahak885 commented Apr 2, 2024

Puck Editor (version: 0.14.1)
Stack: Next JS pages router (version: 13.1.2)

Provide environment information

Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: 1.22.21
  pnpm: N/A
Relevant Packages:
  next: 13.1.2
  eslint-config-next: 13.1.2
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 4.9.4

When I upgrade Puck Editor to 0.14.1, I encountered this error.

image
20240402_150156

@chrisvxd
Copy link
Member

chrisvxd commented Apr 2, 2024

Hi @Sahak885 - could you please confirm

  1. Your browser
  2. Whether https://demo.puckeditor.com works for you
  3. Whether a production build works

Thanks!

@Sahak885
Copy link
Author

Sahak885 commented Apr 2, 2024

  1. Google Chrome 121.0.6167.85
  2. In the demo version, it worked correctly
  3. Build worked

@hrachgalstyan
Copy link

I encountered the identical problem following the library upgrade too.

@hrachgalstyan
Copy link

Hi @Sahak885 - could you please confirm

  1. Your browser
  2. Whether https://demo.puckeditor.com works for you
  3. Whether a production build works

Thanks!

  1. Safari 17.2.1
  2. Yes. It work's for me
  3. Yes. Works

@HakobjanyanHayk
Copy link

Got the same issue

  1. Version 119.0.6045.123 (Official Build) (arm64)
  2. works
  3. works

@chrisvxd
Copy link
Member

chrisvxd commented Apr 2, 2024

Thanks all! I'm struggling to reproduce. Would someone be able to provide me with a repo that reproduces the issue?

@Sahak885
Copy link
Author

Sahak885 commented Apr 2, 2024

image

@chrisvxd
Copy link
Member

chrisvxd commented Apr 2, 2024

Thanks @Sahak885 but I'm looking for a code example (GitHub repository) that reproduces the issue so I can debug it.

The error message makes it look like an environment issue, but I'm not sure what's triggering it.

@hrachgalstyan
Copy link

hrachgalstyan commented Apr 2, 2024

Thank @chrisvxd for your answer. I can send you our package.json file. You can check versions and try to debug it

{
  "name": "",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint --fix",
    "prepare": "husky",
    "prettier": "prettier --write"
  },
  "lint-staged": {
    "*.{ts,tsx,js,jsx,css}": [
      "prettier --write",
      "eslint"
    ]
  },
  "dependencies": {
    "@ckeditor/ckeditor5-build-decoupled-document": "41.1.0",
    "@ckeditor/ckeditor5-react": "6.2.0",
    "@ckeditor/ckeditor5-upload": "^41.1.0",
    "@dnd-kit/core": "^6.1.0",
    "@dnd-kit/sortable": "^8.0.0",
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.0",
    "@fullcalendar/core": "^6.1.4",
    "@fullcalendar/daygrid": "^6.1.4",
    "@fullcalendar/interaction": "^6.1.1",
    "@fullcalendar/react": "^6.1.4",
    "@fullcalendar/timegrid": "^6.1.1",
    "@headlessui/react": "^1.7.8",
    "@hello-pangea/dnd": "^16.5.0",
    "@leafygreen-ui/icon-button": "^15.0.20",
    "@leafygreen-ui/leafygreen-provider": "^3.1.11",
    "@leafygreen-ui/password-input": "^1.0.17",
    "@mantine/core": "^6.0.2",
    "@mantine/hooks": "^6.0.2",
    "@measured/puck": "^0.14.1",
    "@mui/material": "^5.15.12",
    "@next/font": "13.1.2",
    "@pqina/pintura": "file:local_modules/pintura",
    "@pqina/react-pintura": "^9.0.3",
    "@reduxjs/toolkit": "^1.9.1",
    "@stripe/react-stripe-js": "^2.4.0",
    "@stripe/stripe-js": "^2.4.0",
    "@tailwindcss/line-clamp": "^0.4.2",
    "@tippyjs/react": "^4.2.6",
    "@types/file-saver": "^2.0.5",
    "@types/node": "18.11.18",
    "@types/react": "18.0.27",
    "@types/react-dom": "18.0.10",
    "@uiw/react-markdown-preview": "^4.1.13",
    "@uiw/react-md-editor": "^3.20.10",
    "@vercel/analytics": "^1.0.0",
    "@x1mrdonut1x/nouislider-react": "^3.4.3",
    "apexcharts": "^3.37.1",
    "clsx": "^2.1.0",
    "date-fns": "^2.29.3",
    "easymde": "^2.18.0",
    "eslint-config-next": "13.1.2",
    "file-saver": "^2.0.5",
    "formik": "^2.2.9",
    "highcharts": "^11.3.0",
    "highcharts-react-official": "^3.2.1",
    "highlight.js": "^11.7.0",
    "i18next": "^22.4.10",
    "import": "^0.0.6",
    "jwt-decode": "^4.0.0",
    "lottie-react": "^2.4.0",
    "mantine-datatable": "2.6.5",
    "muuri": "^0.9.5",
    "next": "^13.1.2",
    "next-auth": "^4.22.1",
    "next-remove-imports": "^1.0.11",
    "next-transpile-modules": "^10.0.1",
    "ni18n": "^1.0.5",
    "react": "18.2.0",
    "react-18-image-lightbox": "^5.1.4",
    "react-animate-height": "^3.1.0",
    "react-apexcharts": "^1.4.0",
    "react-click-away-listener": "^2.2.2",
    "react-color": "^2.19.3",
    "react-colorful": "^5.6.1",
    "react-confetti": "^6.1.0",
    "react-copy-to-clipboard": "^5.1.0",
    "react-countup": "^6.4.1",
    "react-datetime-picker": "^5.6.0",
    "react-debounce-input": "^3.3.0",
    "react-detect-click-outside": "^1.1.7",
    "react-device-detect": "^2.2.3",
    "react-dom": "18.2.0",
    "react-export-table-to-excel": "^1.0.6",
    "react-flatpickr": "^3.10.13",
    "react-i18next": "^12.1.5",
    "react-images-uploading": "^3.1.7",
    "react-markdown": "^8.0.7",
    "react-perfect-scrollbar": "^1.5.8",
    "react-phone-input-2": "^2.15.1",
    "react-player": "^2.14.1",
    "react-popper": "^2.3.0",
    "react-redux": "^8.0.5",
    "react-router-dom": "^6.22.3",
    "react-select": "^5.7.0",
    "react-shadow-picker": "^1.1.0",
    "react-simplemde-editor": "^5.2.0",
    "react-sortablejs": "^6.1.4",
    "react-spring": "^9.7.1",
    "react-text-mask": "^5.5.0",
    "react-use": "^17.4.0",
    "react-use-measure": "^2.1.1",
    "react-world-flags": "^1.5.1",
    "rehype-sanitize": "^5.0.1",
    "rodal": "^2.1.0",
    "ruuri": "^2.1.0",
    "simple-web-notification": "^2.0.1",
    "socket.io-client": "^4.7.4",
    "sortablejs": "^1.15.0",
    "storybook": "^8.0.0",
    "stripe": "^14.14.0",
    "sweetalert2": "^11.6.13",
    "sweetalert2-react-content": "^5.0.7",
    "swiper": "^8.4.7",
    "typescript": "4.9.4",
    "uuid": "^9.0.0",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@tailwindcss/forms": "^0.5.3",
    "@tailwindcss/typography": "^0.5.8",
    "@types/lodash": "^4.14.191",
    "@types/react-color": "^3.0.12",
    "@types/react-copy-to-clipboard": "^5.0.4",
    "@types/react-flatpickr": "^3.8.8",
    "@types/react-text-mask": "^5.4.11",
    "@types/react-world-flags": "^1.4.2",
    "@types/sortablejs": "^1.15.0",
    "autoprefixer": "^10.4.13",
    "eslint": "8.57.0",
    "husky": "^9.0.11",
    "lint-staged": "^15.2.2",
    "postcss": "^8.4.21",
    "prettier": "^3.2.5",
    "prettier-plugin-tailwindcss": "^0.2.0",
    "tailwindcss": "^3.2.4"
  }
}
Screenshot 2024-04-02 at 23 33 56

@Sahak885
Copy link
Author

Sahak885 commented Apr 3, 2024

Hi @chrisvxd, to reproduce the issue, here's an example:

import { loadStripe } from "@stripe/stripe-js"; 

  useEffect(() => {
    loadStripe("key")
      .then(stripe => {
        console.log(stripe, 'stripe')
      })
      .catch(err => {
        console.error(err);
      });
  }, []);

When using this code in the Puck editor component, an error occurred

image

@Sahak885
Copy link
Author

Sahak885 commented Apr 3, 2024

Thanks @Sahak885 but I'm looking for a code example (GitHub repository) that reproduces the issue so I can debug it.

The error message makes it look like an environment issue, but I'm not sure what's triggering it.

Repository: https://github.com/Sahak885/puck-editor-frame-issue

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

Thanks for the reports. I think I know what's going on. Our underlying dnd fork (@measured/dnd) is not discriminating between the Puck iframe and other iframes. The other iframes exist on other origins, which is causing this security issue.

Will patch @measured/dnd.

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

Would someone mind confirming if this is resolved in 0.14.2-canary.03ab0bd?

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

Reopening until fix confirmed

@chrisvxd chrisvxd reopened this Apr 3, 2024
@Sahak885
Copy link
Author

Sahak885 commented Apr 3, 2024

image

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

@Sahak885 looks like a new issue. Again, I cannot reproduce. Can you please provide an example of how to reproduce this new error?

@hrachgalstyan
Copy link

Screenshot 2024-04-03 at 16 47 20

The same issue

@hrachgalstyan
Copy link

When I try to open editor I get this error. I think it comes from new iframe functionality

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

@hrachgalstyan that's a new error message, but same as @Sahak885 . The previous one was a security warning.

I could really do with a code example to reproduce, but I'm going to try something else to tighten it up and see if it helps.

@hrachgalstyan
Copy link

Screenshot 2024-04-03 at 16 50 14 Screenshot 2024-04-03 at 16 50 49

When I am disable iframe it works fine

@hrachgalstyan
Copy link

@hrachgalstyan that's a new error message, but same as @Sahak885 . The previous one was a security warning.

I could really do with a code example to reproduce, but I'm going to try something else to tighten it up and see if it helps.

The previous one seems to work

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

I've pushed a potential fix and republished again. Please try again in the latest canary 0.14.2-canary.2b2ef32

@hrachgalstyan
Copy link

I've pushed a potential fix and republished again. Please try again in the latest canary 0.14.2-canary.2b2ef32

Screenshot 2024-04-03 at 16 59 25

Is it the latest version?

@chrisvxd
Copy link
Member

chrisvxd commented Apr 3, 2024

0.14.2-canary.2b2ef32 is the latest version. You have to explicitly install it (i.e. put 0.14.2-canary.2b2ef32 instead of ^0.14.2-canary.2b2ef32 in your package.json).

@hrachgalstyan
Copy link

0.14.2-canary.2b2ef32 is the latest version. You have to explicitly install it (i.e. put 0.14.2-canary.2b2ef32 instead of ^0.14.2-canary.2b2ef32 in your package.json).

It loads very hard

https://www.loom.com/share/feb9547ccc80402087ce2d9a100a5850

@Sahak885
Copy link
Author

Sahak885 commented Apr 11, 2024

Hi @chrisvxd ,

Repository updated with the following:

  1. Issue with runs slowly: Link to Loom video.
  2. Issue with forced dragging: Link to Loom video.

Regarding the second issue, when I click on items, the system automatically assumes I want to drag them.

Thanks!

@chrisvxd
Copy link
Member

Thanks @Sahak885. The second issue has been fixed in the latest canary, but I'll dig into the slow load now.

@Sahak885
Copy link
Author

Thanks @Sahak885. The second issue has been fixed in the latest canary, but I'll dig into the slow load now.

Is the second issue fixed in this version @measured/puck@0.14.2-canary.e6e01c6?

@chrisvxd
Copy link
Member

@Sahak885 I believe I've also fixed the slow load issue when dragging the item into the page. Please note, this is different to the issue you reported the other day.

I've tested and it seems to be working in 0.14.2-canary.e529e85. NB when using canaries, you must avoid using ^ in your package.json, i.e.

    "@measured/puck": "0.14.2-canary.e529e85",

Please test the fix and report back if it addresses your remaining issues.

@Sahak885
Copy link
Author

@Sahak885 I believe I've also fixed the slow load issue when dragging the item into the page. Please note, this is different to the issue you reported the other day.

I've tested and it seems to be working in 0.14.2-canary.e529e85. NB when using canaries, you must avoid using ^ in your package.json, i.e.

    "@measured/puck": "0.14.2-canary.e529e85",

Please test the fix and report back if it addresses your remaining issues.

Hi @chrisvxd,

Regarding the first issue, it's still running slowly, but you can find the updated video on Loom here.
As for the second issue, the problem with forced dragging has been resolved.

Thanks!

@Sahak885
Copy link
Author

Hi @chrisvxd , May I verify the issue? Which version are you referring to?

@chrisvxd
Copy link
Member

Hi @Sahak885. I believe the latest canary 0.14.2-canary.e585f20 should completely eliminate your slow load issues, however your example repo still encounters significant lag when auto-scrolling. I'm investigating further.

@Sahak885
Copy link
Author

Sahak885 commented Apr 16, 2024

Hi @Sahak885. I believe the latest canary 0.14.2-canary.e585f20 should completely eliminate your slow load issues, however your example repo still encounters significant lag when auto-scrolling. I'm investigating further.

In this version, the iframe doesn't show.
Video on Loom here.

@chrisvxd
Copy link
Member

@Sahak885 😭 any console logs or anything? I'm unable to reproduce that in your example repo.

Kapture.2024-04-16.at.08.03.25.mp4

@Sahak885
Copy link
Author

@Sahak885 😭 any console logs or anything? I'm unable to reproduce that in your example repo.

Kapture.2024-04-16.at.08.03.25.mp4

I have updated the repository. Should we pull the changes?

@Sahak885
Copy link
Author

Could you please run yarn build and yarn start

@Sahak885
Copy link
Author

This issue occurred in production mode. To reproduce:

  1. Run yarn build
  2. Then, run yarn start

@chrisvxd
Copy link
Member

@Sahak885 no need to pull the changes - they have significant improvements.

Thank you so much for the reproduction steps. I was able to reproduce, and this should be fixed in 0.14.2-canary.717ccb9. Please confirm!

The last thing is the slow auto-scroll (auto-scroll enables the frame to automatically scroll whilst dragging at the edges of the viewport). This is complex to fix, and I think I'll have to completely replace the dnd library to address. An intermediary solution may be to disable auto scrolling for larger payloads.

@Sahak885
Copy link
Author

Sahak885 commented Apr 16, 2024

Worked! Thank you so much @chrisvxd.

@Sahak885
Copy link
Author

Sahak885 commented Apr 16, 2024

Sometimes the website works fine, but at other times, it doesn't. I'm not sure why, but it occasionally occurs in production mode.
Video on loom here.

@Sahak885
Copy link
Author

image

@Sahak885
Copy link
Author

When I hard reload my page and then go to the Puck Editor page, the issue occurs.

@Sahak885
Copy link
Author

Sahak885 commented Apr 16, 2024

This issue only occurred in production mode, dev mode worked correctly.

@chrisvxd
Copy link
Member

@Sahak885 I'm unable to reproduce that in your reproduction repo. Since it's inconsistent, it sounds like it's a cache issue.

Please try a different browser, reinstalling your next modules from scratch and deleting your .next directory.

@Sahak885
Copy link
Author

I have done them, but the same issue exists in production after a hard reload page (CTRL + SHIFT + R).

@chrisvxd
Copy link
Member

@Sahak885 can you reproduce in your https://github.com/Sahak885/puck-editor-frame-issue repo? I am unable to.

@Sahak885
Copy link
Author

I don't know why, but that issue occurred when using these two packages in the main repository

import Tippy from '@tippyjs/react';
import 'tippy.js/dist/tippy.css'; 

or

import Flatpickr from "react-flatpickr";
import "flatpickr/dist/flatpickr.css";

@chrisvxd
Copy link
Member

Thanks @Sahak885, I'll investigate further.

@chrisvxd
Copy link
Member

@Sahak885 I could not reproduce your issues, but I have since published another canary that may help.

Could you test with 0.14.3-canary.73b83ef and let me know if that helps or impacts performance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants