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

feat: restore documentation examples #321

Merged
merged 18 commits into from
Oct 22, 2024

Conversation

stone-lyl
Copy link
Collaborator

@stone-lyl stone-lyl commented Oct 18, 2024

website playground:

website.mp4

node server playground:

node.mp4

vscode

vscode.mp4
Before After
image image
  • fix: resolve node server could not auto restart
    • the previous nodemon couldn't auto-restart on Windows. I've switched to pm2 now.
Before After
image image

Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
data-story-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 8:26am

Copy link
Owner

@ajthinking ajthinking left a comment

Choose a reason for hiding this comment

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

Appreciate 🙏 🌟

Testing pm2

Works great on mac. Tested making a change in a TS file, the server immediately restarted with change applied 👍

Possible updateDiagram bug?

image image

Not sure when/how I triggered this. Possibly just when adding/moving nodes?

Unfolding bug

image

Unclear when this bug was introduced. Might be unrelated/out of scope to this PR.

Vscode broken

When creating a new diagram I noticed:

  • slightly longer load time (seeing spinner)
  • I could not run (no items shown)
  • when switching between files seeing this:
image

packages/ds-ext/src/DiagramEditorProvider.ts Show resolved Hide resolved
packages/ds-ext/src/app/App.tsx Show resolved Hide resolved

// Send the message to VS Code extension
window.vscode.postMessage(updatedData);
client?.updateDiagram?.(diagram);
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need the safe(?) operators here? At this time, could/should we enforce a client always to be present?

@@ -5,6 +5,6 @@ export const onUpdateDiagram: MessageHandler = async ({
event,
document,
}) => {
document.update(new TextEncoder().encode(event.diagram));
document.update(new TextEncoder().encode(JSON.stringify(event.diagram)));
Copy link
Owner

Choose a reason for hiding this comment

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

This is quite a change, might be related to section "Vscode broken"?

Copy link
Collaborator Author

@stone-lyl stone-lyl Oct 21, 2024

Choose a reason for hiding this comment

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

Yes, I've standardized the data format returned by the various servers (jsServer, socketServer, and vscodeServer). Therefore, we need to recreate the .diagram.json file in ds-ext 😂

@@ -16,7 +16,7 @@
"test": "yarn run -T vitest",
"build": "tsc",
"release": "yarn run -T release-it",
"watch:server": "nodemon"
"watch:server": "pm2 start ./test-server.ts --watch --no-daemon"
Copy link
Owner

Choose a reason for hiding this comment

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

Worked great 👍

loading: diagramDataLoading,
error: diagramDataError
} = useRequest(async() => {
return client?.getDiagram?.({});
Copy link
Owner

@ajthinking ajthinking Oct 19, 2024

Choose a reason for hiding this comment

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

Same as before, on (?): can we require client always present?

@@ -21,15 +21,69 @@ export class WorkspaceApiClientBase implements WorkspaceApiClient {

constructor(private transport: Transport) {
this.initExecutionUpdateHandler();
Copy link
Owner

Choose a reason for hiding this comment

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

Good shortenings below - keep same pattern here? ie initExecutionUpdates(); ?

this.run = this.run.bind(this);
this.updateDiagram = this.updateDiagram.bind(this);
}

//<editor-fold desc="Message handler">
Copy link
Owner

Choose a reason for hiding this comment

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

Seen these a few times - not sure when/how introduced?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a comment used for code folding, allowing us to keep the methods related to init folded.

  • expanded mode
    image

  • collapsed mode
    image

@stone-lyl
Copy link
Collaborator Author

Possible updateDiagram bug?

This is not a bug.
Since the socket server doesn't save the diagram, it doesn't implement the updateDiagram method.

Unfolding bug

I've resolved the issue, but I found another one : the eventManager is shared on the same page. When I run the Unfolded Main diagram demo, the Main diagram demo resets to its initial state.
I'm not quite sure if this issue needs to be addressed right away.

image

@ajthinking
Copy link
Owner

Possible updateDiagram bug?

This is not a bug. Since the socket server doesn't save the diagram, it doesn't implement the updateDiagram method.

Unfolding bug

I've resolved the issue, but I found another one : the eventManager is shared on the same page. When I run the Unfolded Main diagram demo, the Main diagram demo resets to its initial state. I'm not quite sure if this issue needs to be addressed right away.

image

I see!

Yes lets "solve" this for now by only supporting one component per page 👍

@stone-lyl stone-lyl merged commit bf0f192 into ajthinking:main Oct 22, 2024
3 checks passed
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.

2 participants