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

Merge branch 'main' into feature/add-page-improvements #377

Merged
merged 21 commits into from
Sep 21, 2023

Conversation

nmanu1
Copy link
Contributor

@nmanu1 nmanu1 commented Sep 20, 2023

Note: the size limit needed to be updated now that we are importing the default export from react-select

tmeyer2115 and others added 21 commits August 31, 2023 09:07
## Changes
- Studio's startup time is now considerably faster. This is due to an
improvement in the logic for parsing Component and Template files.
(#357)
- The Studio Plugin is now a direct, explicit dependency of Studio. That
means users only have to install `@yext/studio`. They don't need to
worry about manually installing `@yext/studio-plugin` as well. (#355)
TEST=manual
J=None

tested that dynamic imports work on both windows and mac

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
### Changes
* Remove duplicate slash in browser dynamic imports on mac/ubuntu #361
Images in the Playwright tests were not completely rendered before screenshots were taken.  This really only affected our tests for `add-element` and `rearrange-elements`.  This PR changes all full-page and preview screenshots to check for iFrame images to load before capturing the screenshot.

J=SLAP-2913
TEST=auto, manual
J=SLAP-2917
TEST=manual

updates studio and studio-plugin versions to next minor
This PR introduces Layouts to Studio. Studio now recognizes layouts that
appear in `src/layouts` (or a custom dir) and stores their filepaths in
a new `layouts` slice. Layout names are derived from the layout's
filename. Tests were updated to reflect changes in studio config. A test
was written to check that layout files are found from the `layouts` dir.

The current `LayoutSlice` just contains a `string[]` of the names of the
layouts in the layouts dir. This is simply a place holder, since no
layout parsing was implemented yet. Layout parsing and the LayoutSlice
will be fleshed out in future PRs in the epic.

J=SLAP-2923
TEST=auto,manual
This PR removes repeaters and modules from Studio.

J=SLAP-2928
TEST=auto
This PR creates a new `LayoutMetadata` domain model to represent a
Layout. A new `LayoutFile` sourcefile is added for parsing layouts.
Currently, we only support layouts in the top-level of the `src/layouts`
directory (i.e. no nested folders). Any nested directories for both
layout and pages will now be ignored.

I opted not to create a model for layouts with errors because, for now,
this information is not anticipated to be used in the UI. Like
components, we will not be showing layouts with errors in the Add
Element menu. Unlike components, there is nowhere else in the UI an
errored layout would surface, since it's not a "component" that would be
part of a component tree. The parsing error is still logged in the
terminal though.

J=SLAP-2929
TEST=auto

Since much of the logic is shared between parsing a page and parsing a
layout, I moved the tests for parsing a component tree into a separate
file so only sourcefile-specific tests remain in
`PageFile.getPageState.test.tsx`.

---------

Co-authored-by: Oliver Shi <[email protected]>
This PR removes top-level fragments from the component tree of each layout in the layout slice so they won't be displayed in the UI when adding a layout to a new page. HMR is also updated to re-sync layouts in the store when a layout file is changed or a full sync is performed.

J=SLAP-2937
TEST=manual

In the test-site, saw that if `LocationLayout` had a top-level fragment, it was not present in the component tree in the `layouts` record. Also, checked that updating `LocationLayout` while running the test-site would correctly update it's component tree in the store.
This PR implements adding layouts via the AddElementMenu/Button.

J=SLAP-2924
TEST=manual,auto

I can add layouts multiple times, set the newly added components as
active, and save to file
updated AddElementMenu tests

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This PR separates the react and zustand code into yext/studio-ui.
A future PR will replace the typescript compiler with a bundler, which
will reduce round trips done by the vite dev server
and also allow us to minify the code.

generateTailwindSafelist had to be moved into studio-plugin, otherwise
postcss would complain about things like `window` not existing. This was
due to postcss importing all of studio-ui when it tries to import
generateTailwindSafelist, and postcss running on node while studio-ui
expecting to be run in the browser. Previously, it would directly
import the ts file, and rely on whatever transpilation postcss/tailwind
are doing.

J=SLAP-2919
TEST=manual

dev flow still works - I can make an edit in studio-ui with the dev
watch running and the test-site will receive updates
it's a full page reload every time now though

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: nmanu1 <[email protected]>
Bundles studio-ui to reduce multiple round trips made by the browser to
the vite dev server.
The browser still makes network requests for things like localData and
component files.
One way to reduce perceived lag here is server side rendering studio.
Another is the loading indicator we have planned.

DOMContentLoaded is now 412ms instead of 5.09s. 
There should be a bigger improvement in CBD due to network requests
taking longer there compared to local.
5.0MB transferred instead of 14.6MB (could be smaller probably but still
yay!)

Removes ts-morph/typescript dependencies from TypeGuards and by
extension the ui bundle (they are big packages).
Updates lodash imports to use smaller scoped imports.
Adds vite plugins for bundle size, css in js, dts files, and svg
imports.

J=SLAP-2921
TEST=manual

I can start up studio and see less requests in the network tab

old network tab

https://github.com/yext/studio/assets/23005393/022d6199-5fa6-47db-b84b-5e543c729ae3

new network tab

![image](https://github.com/yext/studio/assets/23005393/45c9d4d1-b25c-4d16-bb0a-fdbe5ca01d3c)
@tmeyer2115 tmeyer2115 self-requested a review September 21, 2023 18:29
@nmanu1 nmanu1 merged commit 53de275 into feature/add-page-improvements Sep 21, 2023
15 checks passed
@nmanu1 nmanu1 deleted the dev/merge-main-branch branch September 21, 2023 18:34
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.

4 participants