Git Product home page Git Product logo

offline-examples's Introduction

Offline Examples

A collection of example applications using react-relay-offline.

and

A collection of example applications using @wora/apollo-offline.

Relay

React

cd relay/todo-updater
yarn
yarn build
yarn start

React Native

  • change local ip address
cd relay/react-native/todo-updater/src/relay
modify file: index.ts

const localIP = "SETLOCALIP"

with your local ip
  • start server relay
cd relay/react-native/todo-updater/server
npm install
npm run start
  • Starts the server that communicates with connected devices
cd relay/react-native/todo-updater
npm install
npm run start
  • Run android
cd relay/react-native/todo-updater
npm run android

Apollo

React

cd apollo/todo/client
npm install
npm run start
cd apollo/todo/server
npm install
npm run start

React Native

  • change local ip address
cd apollo/react-native/todo/src/apollo
modify file: index.ts

const localIP = "SETLOCALIP"

with your local ip
  • start server relay
cd apollo/react-native/todo/server
yarn
yarn start
  • Starts the server that communicates with connected devices
cd apollo/react-native/todo
yarn
yarn start
  • Run android
cd apollo/react-native/todo
yarn run android

offline-examples's People

Contributors

dependabot[bot] avatar kmjennison avatar martin-888 avatar morrys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

offline-examples's Issues

Error: Type 'undefined' is not assignable to type 'RecordProxy<{}>'.

I'm seeing this error when running yarn dev:

ERROR in /my/path/offline-examples/relay/nextjs/mutations/AddTodoMutation.ts
64:37 Argument of type 'RecordProxy<{}> | null | undefined' is not assignable to parameter of type 'RecordProxy<{}>'.
  Type 'undefined' is not assignable to type 'RecordProxy<{}>'.
    62 | 
    63 |   // Insert the new todo into the Todo List connection
  > 64 |   ConnectionHandler.insertEdgeAfter(conn, newEdge);
       |                                     ^
    65 | }
    66 | 
    67 | function commit(environment: RelayModernEnvironment, text: string, user: any) {

This error is happening with cleared storage on localhost using the packages updated in #16.

I think it's caused by this TypeScript bug, because downgrading to 3.0.1 fixes it:
microsoft/TypeScript#29505

PR incoming to downgrade TypeScript.

[Next.js] service-worker.js returns 404

The server.js should define the /service-worker.js path. Resolving it to join(__dirname, '.next', 'static', pathname) worked for me here.

Currently setting the service worker generateInDevMode to true in next.config.js fails to register the service worker.

"Invalid AST Node" from outdated TS relay-compiler

I got this error when running yarn compile:

Writing ts
ERROR:
Error writing modules:
Error: Invalid AST Node: { QUERY_TYPE_KEY: Symbol(Query), MUTATION_TYPE_KEY: Symbol(Mutation), SUBSCRIPTION_TYPE_KEY: Symbol(Subsription), _baseSchema: { __validationErrors: [], extensions: undefined, astNode: undefined, extensionASTNodes: undefined, __allowedLegacyNames: [], _queryType: Query, _mutationType: Mutation, _subscriptionType: undefined, _directives: [Array], _typeMap: [Object], _possibleTypeMap: {}, _implementations: [Object] }, _extendedSchema: { __validationErrors: undefined, extensions: undefined, astNode: undefined, extensionASTNodes: [], __allowedLegacyNames: [], _queryType: Query, _mutationType: Mutation, _subscriptionType: null, _directives: [Array], _typeMap: [Object], _possibleTypeMap: {}, _implementations: [Object] }, _typeMap: {}, _fieldsMap: {}, _typeNameMap: {}, _clientIdMap: {}, _possibleTypesMap: {}, _directivesMap: {} }
    at visit (/Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/graphql/language/visitor.js:236:15)
    at Object.visitIR [as visit] (/Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler/lib/core/GraphQLIRVisitor.js:41:10)
    at Object.exports.generate (/Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler-language-typescript/lib/TypeScriptGenerator.js:19:42)
    at /Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler/bin/relay-compiler:11541:64
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at /Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
    at new Promise (<anonymous>)
    at /Users/kevinjennison/dev/offline-examples/relay/nextjs/node_modules/relay-compiler/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
error Command failed with exit code 100.

It seems caused by the old version of relay-compiler-language-typescript. I'm sending a PR to update it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.