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: Remote Source Code Loading Bug #23

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

sleslein
Copy link
Contributor

@sleslein sleslein commented Jan 30, 2024

We've encountered an issue with loading source code examples from a remote end point. In our case the playground is not rendered on the client initially. When we do open the playground, we want the code visible immediately. On the first interaction to open the playground the code is displayed as expected. However, if we close the playground and attempt to reopen it, the code is not displayed. Clicking the hide code/show code button to toggle the Playground code editor allows the code to be visible again.

The code seems to be properly loaded from the endpoint, yet its not displayed in the editor pain.

Consider the following video example:

Screen.Recording.2024-01-30.at.3.11.32.PM.mov

Solution:
After debugging is seems like the underlying code mode was being initialized to an empty array. After the files were imported from from the remote server, the underlying models were not being updated with the new file contents.

This 97b8225 re-initializes the array of models if it's an empty array and array of files contains items. With this change the code samples are properly loaded into the file viewer.

Screen.Recording.2024-01-30.at.3.51.30.PM.mov

@CLAassistant
Copy link

CLAassistant commented Jan 30, 2024

CLA assistant check
All committers have signed the CLA.

@sleslein sleslein marked this pull request as ready for review January 30, 2024 22:42
Copy link
Collaborator

@hua-lu hua-lu left a comment

Choose a reason for hiding this comment

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

LGTM, thanks~

@sleslein sleslein force-pushed the fix-remote-source-loading branch from 97b8225 to 971b510 Compare February 22, 2024 17:45
@hua-lu hua-lu merged commit 066f356 into freewheel:main Feb 26, 2024
1 check failed
@hua-lu hua-lu changed the title Fix Remote Source Code Loading Bug fix: Remote Source Code Loading Bug Feb 26, 2024
hua-lu pushed a commit that referenced this pull request Feb 26, 2024
* add remote source example

* fix: init model when files loaded
github-actions bot pushed a commit that referenced this pull request Feb 26, 2024
## [1.2.8](v1.2.7...v1.2.8) (2024-02-26)

### Bug Fixes

* Remote Source Code Loading Bug ([#23](#23)) ([37122a2](37122a2))
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.

3 participants