facebook / yoga

Yoga is an embeddable layout engine targeting web standards.
https://yogalayout.dev/
MIT License
17.11k stars 1.42k forks source link

Share button is not working in yoga playground #1077

Closed edwardfoux closed 7 months ago

edwardfoux commented 3 years ago

Report

Url shortener is not working in Yoga playground.

Issues and Steps to Reproduce

Open yoga playground page https://yogalayout.com/playground/ create a test yoga layout Click "Share URL" Instead of url, I get "See /corsdemo for more info"

Expected Behavior

Short url to the yoga playground setup

Actual Behavior

"See /corsdemo for more info"

Link to Code

The full url still works: https://yogalayout.com/playground/?eyJ3aWR0aCI6NTAwLCJoZWlnaHQiOjUwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MSwicGFkZGluZyI6eyJ0b3AiOiIyMCIsInJpZ2h0IjoiMjAiLCJib3R0b20iOiIyMCIsImxlZnQiOiIyMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9LCJjaGlsZHJlbiI6W3sid2lkdGgiOiIiLCJoZWlnaHQiOiIxMjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9LCJjaGlsZHJlbiI6W3sid2lkdGgiOjEwMCwiaGVpZ2h0IjoxMDAsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOjEwMCwiaGVpZ2h0IjoxMDAsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOjEwMCwiaGVpZ2h0IjoxMDAsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19XX1dfQ==

The "Share URL" used to work in the past

Anup0099 commented 2 years ago

@edwardfoux can you please elaborate on the expected behavior?

edwardfoux commented 2 years ago

Current: click on "Share Url" button in upper right corner and observe "See /corsdemo for more info" text instead of url

Expected: click on "Share Url" button in upper right corner and observe a short url of the format http://.

At least it used to work like described in the "expected" case.

NickGerleman commented 7 months ago

We are building a new playground as part of a website migration. It has shareable URLs, but does not rely on a shortener service. As of https://github.com/facebook/yoga/pull/1516 it does something a bit smarter than just base-64 encoding the input though.

// https://github.com/facebook/yoga/issues/1067
<Layout config={{ useWebDefaults: false }}>
  <Node style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
    <Node style={{ borderWidth: 1, justifyContent: 'space-between' }}>
      <Node style={{ height: 100, width: 100 }} />
      <Node style={{ height: 100, width: 100 }} />
    </Node>
    <Node style={{ borderWidth: 1, justifyContent: 'space-between' }}>
      <Node style={{ height: 150, width: 100 }} />
      <Node style={{ height: 150, width: 100 }} />
    </Node>
  </Node>
</Layout>

http://localhost:3000/playground?code=PTAEAsBdIBwZwFwgOYEtLgK4CMB0BjAewFtgAzAQ3wFNtDCBrYAT0OQuFTjk2rmACMABgBsAdgBQAHgAyFVpkigiAOzKpkAXgDe2zHGoB1WgBFqlTABtIiUJUsGAvo4B8E0KCkA5QgBNqoHCQzJbUOtp2oQAeJqgATtT4kKiEKgigAORxhADuGQA0kdRRhnEUMOkZOWUwGaDObh4e3n4BQSFhuqB0cf5xhqi+GOkChQBW+slkzADCqZDUKpCVcDBU1AC02NSQOdSLdQ3uTc0+-oHBoeEQ1BpQI0JChTmDw6DCQvWOoMCNJ55nNqXToRcC3ZD3d6PZ6vcAPT7OH5-ZrAQHIgGtC4da49PoDIZw97jSaoaZzJaLZaZVbrLY7PYHL7o06Y9pXLpgu5UgQAVieoBeBPhXyRxxOLXObJBNy5Iz5MKFUIR31+Ys8qNafykGv8bm1cgUkBcQA