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

Pass fragments/query parameters to the preview iframe #600

Open
AndrewLeedham opened this issue Nov 10, 2019 · 2 comments
Open

Pass fragments/query parameters to the preview iframe #600

AndrewLeedham opened this issue Nov 10, 2019 · 2 comments

Comments

@AndrewLeedham
Copy link
Contributor

AndrewLeedham commented Nov 10, 2019

In order to test JavaScript code that uses fragments e.g. #heading or query parameters e.g. ?param=value it is currently fairly tedious, you have to inspect the preview iframe and manually update the src, then reload the frame. These changes aren't stored either so refreshing the page loses them.

Steps to Reproduce

  1. Open a component that uses a hash e.g. <script>console.log(window.location.hash);</script>
  2. Add a hash to the page URL: nothing is logged.
  3. Add the hash to the src attribute on the preview iframe: the hash is logged. But:
  4. Refresh the page, and it will disappear.

Expected behavior: The hash to be passed through to the preview iframe.

Actual behavior: It is not passed through.

Versions

  • What version of Fractal are you running? 1.2.0
  • What version of Node.js are you running? 10.16.3

Additional Information

The simple solution to this would be to just pass hashes/query parameters forward, but a possible additional nicety would be to allow defaults to be set via component/variant properties. So you could provide a hash/query in the config e.g.

{
  "context": {},
  "hash": "heading",
  "query": "param1=value&param2=other"
}

Notes

Original raised on the core fractal repo: #516

@LeBenLeBen LeBenLeBen transferred this issue from frctl/mandelbrot May 23, 2020
@stale
Copy link

stale bot commented Jul 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Jul 25, 2020
@AndrewLeedham
Copy link
Contributor Author

Still relevant

@stale stale bot removed the inactive label Jul 25, 2020
@stale stale bot closed this as completed Aug 1, 2020
@mihkeleidast mihkeleidast reopened this Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants