Skip to content

Django RN demo app: fix some issues picked up during Django backend cleanup #217

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

Merged
merged 12 commits into from
Jul 3, 2024

Conversation

kobiebotha
Copy link
Contributor

@kobiebotha kobiebotha commented Jun 28, 2024

Overview

Builds on work in powersync-ja/powersync-django-backend-todolist-demo#3

  • useStatus in HeaderWidget is currently broken
  • use latest React hooks and context providers
  • Added instructions for using a local Django backend

Testing

This was tested with the local Django backend

nodejsreactnative.mp4

Copy link

changeset-bot bot commented Jul 2, 2024

🦋 Changeset detected

Latest commit: af08596

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
django-react-native-todolist Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

React.useEffect(() => {
Logger.useDefaults();
Logger.setLevel(Logger.DEBUG);

const getSession = async () => {
const response = await fetch('http://127.0.0.1:8000/api/get_session', {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Previously the URL was hardcoded, but besides that the get_session endpoint always returns a valid session. Which makes this logic not really have an affect.

The user should now be able to register and login - although that is not strictly required by the backend (it will create tokens for PowerSync either way). This login screen process does at least keep this demo in line with other Todolist demos. Correct session management can be added later. Users will unfortunately have to signin each time the app boots. Alternatively signin could just be dropped altogether.

@stevensJourney stevensJourney marked this pull request as ready for review July 3, 2024 11:39
@@ -2,20 +2,26 @@ import { Column, ColumnType, Index, IndexedColumn, Schema, Table } from '@powers

export const AppSchema = new Schema([
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be changed to use the V2 table?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah can do that. This now uses TableV2

@stevensJourney stevensJourney merged commit 9842df6 into main Jul 3, 2024
2 checks passed
@stevensJourney stevensJourney deleted the chore/polish-django-demo branch July 3, 2024 17:27
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