-
Notifications
You must be signed in to change notification settings - Fork 1
Load experiment from remote URL #187
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the ability to load experiments from remote URLs using the ?e=<url> query parameter, addressing issue #158. Users can now share experiments by hosting JSON files on CORS-enabled servers.
- Added URL-based experiment loading via the
?equery parameter - Enhanced toast notifications to persist error messages with a close button
- Provided comprehensive documentation including local development setup examples
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/class-solid/src/lib/state.ts | Implements loadExperimentFromUrl() function to fetch and load experiments from remote URLs, with toast-based progress feedback |
| apps/class-solid/src/components/ui/toast.tsx | Makes error toasts persistent and adds a close button to allow users to dismiss error messages manually |
| apps/class-solid/README.md | Documents the new URL loading feature with usage examples and local development instructions including CORS setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Do we want to show the making your own link instructions always in the share dialog? Now you only see it when state is >32k chars. |
Peter9192
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
|
|
||
| ## Loading experiment from URL | ||
|
|
||
| A saved state (`class-<experiment-name>.json` file) can be loaded from a URL with the `s` search query parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s or e? The PR top post also says e, but the screenshot of what to do when url too long says s 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be consistent s everywhere except in PR description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, changed my mind to store whole state (s) of app instead of just one experiment (e).
Fixes #158
To use requires remote URL to have CORS enabled, see https://github.com/classmodel/class-web/blob/8aaa7f869089d43a6de745bc556ae01d15caa31f/apps/class-solid/README.md#loading-experiment-from-url
http://localhost:3000/?e=http://localhost:3333/badurlor use same as 1 but with bad url likehttp://localhost:3000/?e=http://localhost:3001/death-valley.jsonpnpm build;pnpm startand in web browser DevTools throttle network.When state is too big for sharable link it shows