Giter VIP home page Giter VIP logo

gossamer-react / lucid Goto Github PK

View Code? Open in Web Editor NEW
404.0 6.0 15.0 38.37 MB

A developer tool for engineers working with React and GraphQL.

Home Page: https://reactlucid.io

License: MIT License

HTML 0.48% JavaScript 87.08% CSS 12.44%
react react-applications graphql chrome react-developers devtools javascript chrome-devtools-extension react-devtools graphql-tools chrome-extensions chrome-devtools apollographql react-state-management graphql-query

lucid's Introduction

Tweet AppVeyor AppVeyor

Lucid: a React-GraphQL developer tool

Lucid is a Chrome Developer Tool designed to help engineers debug their React-GraphQL applications.

  • Visualize the component hierarchy, state/props data and state changes of your React application
  • See your GraphQL schema, queries, and mutations in real-time

Underlying Technology

React Tab

Lucid parses through your React app to generate an interactive tree graph representing your React component hierarchy, with node-specific state and props data. The tree updates upon each change to the React app's state, and displays a log of state diffs on the left. This is done by creating a persistent data bridge to the user's React application via the Javascript API for WebExtensions' background and content scripts. Lucid injects scripts utilizing React DevTool's Global Hook to recursively traverse through the React DOM each time setState is called, resulting in a tree and a log that each display real-time feedback. Our app itself uses React internally so as the state of your live app changes, the Lucid tree graph will also provide visual feedback of data flow and state changes through the React components immediately.

GraphQL Tab

Lucid intercepts HTTP requests using Chrome Devtool APIs to display a log of real-time Apollo client queries and mutations, along with associated response objects. Lucid also uses GraphQL schema introspection to display schema information from the server. This allows full-stack developers to debug their app from the front-end to the back-end, as requests are generated, responses are returned from the server, and data flows through React components to be rendered in the DOM.

Setup

Install from Chrome Extension Store Build your own extension
1. Install React Developer Tools. 1. Clone the repo and npm install
2. Install Lucid or Build your own extension. 2. npm run build
3. Restart Chrome Browser. 3. Navigate to chrome://extensions.
4. Run your React v16+ application using GraphQL. 4. Click Load Unpacked and select your './react-lucid/build' folder.
5. Open Chrome Developer Tools (Inspect) and click on the Lucid panel. Trigger a re-render!

IMPORTANT: Lucid is in BETA mode and works best for React v16+ local projects in development environments.

How to Use

GraphQL Tab

  • In the GraphQL panel, a chronological log of API requests is shown on the left.
  • A GraphQL schema of all available types, queries, and mutations is also automatically fetched from the GraphQL server when Lucid is initialized and displayed on the bottom.
  • Click each request log to see its associated HTTP response.

NOTE: Lucid only listens for HTTP requests while it is open in the Chrome Developer Tool panel. To see any requests that were made upon initial page load, reload your React page after opening Lucid in your Chrome browser.

React Tab

  • In the React panel is a tree graph representing your application's component hierarchy.
  • Hovering over any React Component in the tree displays the state and props data of that component in the top left.
  • The State Diff Log tracks changes in state whenever setState() is triggered.
  • Filter out specified higher-order components from your tree graph (e.g. Redux, Apollo-GraphQL, and React Router) by clicking the buttons.

Contributing

Lucid is currently in beta release. Please let us know about bugs and suggestions at [email protected]. Feel free to fork this repo and submit pull requests!

Coming Soon

Team

Yong-Nicholas Kim (https://github.com/yongnicholaskim)

Nian Liu (https://github.com/nianliu18)

Eterna Tsai (https://github.com/eternalee)

Neyser Zana (https://github.com/neyser95)

License

MIT

lucid's People

Contributors

ecwyne avatar eternalee avatar neyser95 avatar nianliu18 avatar yongnicholaskim 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  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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lucid's Issues

Circular Structure to JSON error

Setup :

  • Windows 10
  • Node 11.6
  • CRA with React v16.7.0-alpha.2

No Graphql or Apollo yet, just a simple React counter with hooks useState and useEffect.

Result :

Please ask me anything to help resolve this bug.

[Feature Request] Firefox Support

Is your feature request related to a problem? Please describe.
I mainly use Firefox, so it would be great if I didn't have to open Chrome to use the extension

Describe the solution you'd like
Support Firefox

time travel between app states

This is a feature that would allow the user to view their application in previous states to have a better idea on how it has change.

diff log parser

The diff log has 2 objects represented as strings: oldstate and newstate. We need a parsing algorithm to convert these strings to PJO (plain javascript object). The complexity of the problem comes from the fact that oldstate and newstate have unpredictable key/value pairs b/c every React app loaded into the devtool will be different.

Please trigger a setState() to activate Lucid devtool.

Describe the bug
I am not sure what is meant by this error message. I do have React devtools installed and working just fine.

To Reproduce
Hard to know, I suppose it's some environment issue since no one else is reporting it.

The app is running React 16.7.0-alpha.2 in development mode. There is react-apollo 2.2.4.

I don't use Redux, so if the setState is somehow related to that, it should be mentioned somewhere.

Expected behavior
It should show the promised wow UI :)

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 x64
  • Browser chrome
  • Version 71

Optimization of tree component

The rendering of the tree starts to take longer as a user's application begins to grow trying to find a good way to enhance the rendering of the tree would be a great.

Allowing devtool to work with all GraphQL servers

The devtool right now only supports Apollo GraphQL servers. Making sure that the devtool works with all types of GraphQL servers show be one of the first updates. This can be done by using the devtools.network to listen to all http requests and create a parser that can parse through all GraphQL queries.

Cannot use with React Dev Tools v4

I just installed Lucid from the Chrome store and I already had the latest React Dev Tools installed - 4.0.5 (8/19/2019). When loading my app in a new tab, I get this error:

Uncaught TypeError: Cannot convert undefined or null to object
at Function.keys ()
at reactTraverser.js:6
(anonymous) @ reactTraverser.js:6

I'm using Chrome Canary on a mac.

It looks like the property _renderers is no longer available on window.__REACT_DEVTOOLS_GLOBAL_HOOK__

Running with v3 of React Dev Tools (https://github.com/facebook/react-devtools/) works though.

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.