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: Update Quickstart #33

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

feat: Update Quickstart #33

wants to merge 8 commits into from

Conversation

PuruVJ
Copy link
Collaborator

@PuruVJ PuruVJ commented Feb 10, 2024

Description of Changes

Running the server wasn't working for me, lot of errors. This change does a few things:

  • create-vite-app instead of create-react-app, speeds up npm install time and overall speed
  • Get rid of testing-lib in the quickstart
  • gitignore module_bindings
  • Instead of separate client, server folders, server lives inside of the Vite App, which allows us to set up the spacetime:* scripts in a sensible manner

Changes to App.tsx

Avoided doing any changes to App.tsx as it reflects the quickstart guide, but some things were quite critical to change:

  1. Move all query listeners to useEffect(fn, []). This is the most important, as before, the listeners were at the top level of the component. Which means, any state change(Even typing the message!) triggered the function to re-run, and by effect, recreate all the listeners without cleaning up the old ones, which caused quite a memory leak on even just changing the username.
  2. Get rid of const client = useRef(spacetimeDBClient). Totally redundant.
  3. Replace all let with const. Lets were giving off the impression that these values would be re-assigned later, but they never were.

TODO:

  • Better styling of chat app
  • Documentation for starting spacetime server, publishing to it, and connecting the UI to it
CleanShot.2024-02-11.at.22.50.58.mp4

API

  • This is NOT an API breaking change to the SDK

If the API is breaking, please state below what will break

Requires SpacetimeDB PRs

List any PRs here that are required for this SDK change to work

@PuruVJ PuruVJ marked this pull request as ready for review February 11, 2024 18:20
@PuruVJ PuruVJ requested review from NateTheDev1 and drogus February 12, 2024 07:15
Copy link
Contributor

Choose a reason for hiding this comment

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

This is our prettierrc across our other projects: { "tabWidth": 4, "semi": true, "singleQuote": true, "arrowParens": "avoid", "jsxSingleQuote": false, "trailingComma": "none", "endOfLine": "auto" }

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