Giter VIP home page Giter VIP logo

recoilize's Introduction

Debugger for Recoil Applications

GitHub license npm version PRs Welcome

Korean README 한국어

About

Recoilize is a Chrome Dev Tool meant for debugging applications built with the experimental Recoil.js state management library.

The tool records Recoil state and allows users to easily debug their applications with features such as: time travel to previous states, visualization of the component graph and display of the atom selector network.

Download Recoilize from the Chrome Store

Visit the Recoilize landing page to demo

** STILL IN BETA **

Please note that Recoilize is in BETA. We will continue to make improvements and implement fixes but if you find any issues, please dont hesitate to report them in the issues tab or submit a PR and we'll happily take a look.

Installation

Install Recoilize Module

npm install recoilize

** IMPORTANT **

Import RecoilizeDebugger from the Recoilize module

import RecoilizeDebugger from 'recoilize';

Integrate RecoilizeDebugger as a React component within the recoil root:

import RecoilizeDebugger from 'recoilize';
import RecoilRoot from 'recoil';

ReactDOM.render(
  <RecoilRoot>
    <RecoilizeDebugger />
    <App />
  </RecoilRoot>,
  document.getElementById('root'),
);

Please note, Recoilize assumes that the HTML element used to inject your React application has an ID of 'root'. If it does not the HTML element must be passed in as an attribute called 'root' to the RecoilizeDebugger component

Example:

import RecoilizeDebugger from 'recoilize';
import RecoilRoot from 'recoil';

//If your app injects on an element with ID of 'app'
const app = document.getElementById('app');

ReactDOM.render(
  <RecoilRoot>
    <RecoilizeDebugger root={app} />
    <App />
  </RecoilRoot>,
  app,
);

In order to integrate Next.js applications with RecoilizeDebugger, follow the example below.

//If your application uses Next.js modify the _app.js as follows
import dynamic from 'next/dynamic';
import { useEffect, useState } from 'react';
import { RecoilRoot } from 'recoil';

function MyApp({ Component, pageProps }) {

  const [root, setRoot] = useState(null)
  const RecoilizeDebugger = dynamic(
	() => {
	  return import('recoilize');
	},
	{ ssr: false}
  );

  useEffect(() => {

    if (typeof window.document !== 'undefined') {
      setRoot(document.getElementById('__next'));
    }
  }, [root]);
 
  return (
    <>
    <RecoilRoot>
      <RecoilizeDebugger root = {root}/>
      <Component {...pageProps} />
    </RecoilRoot>
    </>
  );
}


export default MyApp;

If you would like to use the Testing Window...

--Important--

formatRecoilizeSelectors is expecting you to update your atoms with writeable selectors. If you are using anything else to update your atom values, they will not be able to be read by the testing window. Furthermore, for atom/selector dependencies to be registered, you have to fire off a change in state before you choose a selector from the dropdown. Choosing a selector too soon will break the page.

First, import formatRecoilizeSelectors from Recoilize.

Next, format what will become your selectors as plain objects with the appropriate properties and methods. Then pass that object into the selector function. --

Example:

At the bottom of your file, you will need to pass that same object to the formatRecoilizeSelectors function. --

Repeat this process for all objects that you will use to create recoil selectors, and pass them all in at the same time. Please note that using formatRecoilSelectors more than once in your application will break the testing window and you have to pass in all objects-to-be-used-as-state at the same time. --

Open your application on the Chrome Browser and start debugging with Recoilize!

(Only supported with React applications using Recoil as state management)

New Features for Version 3.1.6

Support for Recoil 0.1.3

Recoilize now supports the most recent update to the Recoil library and is backwards compatible with older versions of Recoil.

Time Travel with ease

If you had used Recoilize before, you would have noticed an annoying bug that sometimes breaks the app and won’t allow you to be productive. With the new version of Recoilize, that issue is forever gone. Users can now use the tool with confidence and worry-free.

The main mission of Recoilize 3.0 is to make it more user-friendly, so you will enjoy our brand new time travel feature — the time travel slider! Why click and scroll through snapshots when you can do it with a slider and some buttons, right?

Customizable Component Graph

This is one of the coolest updates of Recoilize 3.0. We understand that different users have different ways of thinking and visualizing, and for that reason, the component tree now is fully customizable. You can expand or collapse the components, choose vertical or horizontal displays or adjust the spacing between elements.

Better User Experience with Atom Network

The atom network is one of the key features that differentiate Recoil.js from other alternative state management libraries. However, the atom network will grow bigger together with the app. At some points, it will be unmanageable and hard to keep track of all of the atoms. To make this easier and pain-free, the new Atom Network will allow you to freely move and arrange them anywhere you want.

Snapshot Comparison

We understand that developers always develop an app with an optimization philosophy in mind. Component rendering time can be difficult to measure for two reasons. First, your computer and your web browser are not the same as mine, so the run-time can be vastly different. Second, it’s really hard to keep track of a long series of snapshots. You definitely don’t want to waste all of your time calculating the rendering time by hand.

With the new Recoilize, users can now save a series of state snapshots and use it later to analyze/compare with the current series.

Testing Window

As engineers, testing is an invaluable process to ensure the strength of one's application. Without implementing testing on one's application, engineers expose themselves to problems that could have been sought out proactively. With our Recoilize Testing Window, we allow users to implement Recoil testing for specific recoil selectors within their application. Within our testing window, users can review the code behind their selectors, analyze node-to-node subscriptions and dependencies, and test for an expected output of an atom's value, all completely independent of your application's state management.

Features

Support for Concurrent Mode

If a Suspense component was used as a placeholder during component renderings, those suspense components will display with a red border in the expanded component graph. This indicates that a component was suspended during the render of the selected snapshot.

Performance Metrics

In 'Metrics' tab, two graphs display component render times.

The flame graph displays the time a component took to render itself, and all of its child components. The bar graph displays the individual render times of each component.

Throttle

In the settings tab, users are able to set throttle (in milliseconds) for large scale applications or any applications that changes state rapidly. The default is set at 70ms.

State Persistence

Recoilize allows the users to persist their application's state through a refresh or reload. At this time, the user is able to view the previous states in the dev tool, but cannot time travel to the states before refresh.

Additional Features

  • legend to see relationship between component graph and state
  • toggle to view raw component graph
  • filter atom/selector network relationship
  • filter snapshots by atom/selector keys

We will continue updating Recoilize alongside Recoil's updates!

Contributors

Bren Yamaguchi @github @linkedin

Saejin Kang @github @linkedin

Jonathan Escamila @github @linkedin

Sean Smith @github @linkedin

Justin Choo @github @linkedin

Anthony Lin @github @linkedin

Spenser Schwartz @github @linkedin

Steven Nguyen @github @linkedin

Henry Taing @github @linkedin

Seungho Baek @github @linkedin

Aaron Yang @github @linkedin

Jesus Vargas @github @linkedin

Davide Molino @github @linkedin

Taven Shumaker @github @linkedin

Janis Hernandez @github @linkedin

Jaime Baik @github @linkedin

Anthony Magallanes @github @linkedin

Edward Shei @github @linkedin

Nathan Bargers @github @linkedin

Scott Campbell @github @linkedin

Steve Hong @github @linkedin

Razana Nisathar @github @linkedin

Harvey Nguyen @github @linkedin

Leonard Lew @github @linkedin

Victor Wang @github @linkedin

Adam Allison @github @linkedin

William Chu @github @linkedin

Jordan Rice @github @linkedin

Ryan Wallace @github @linkedin

recoilize's People

Contributors

aaronyang824 avatar allisonadam81 avatar amagalla avatar anthonylin198 avatar baohnguyen95 avatar brenyama avatar calibeach avatar davidemmolino avatar henrytaing avatar hobaek avatar jaimebaik avatar janis-h avatar jasonleejml avatar jmodestov avatar joey-ma avatar jonescamilla avatar justinchoo93 avatar leolew97 avatar nbargers avatar oscarychen avatar razananisathar avatar rwallie avatar skang1004 avatar smithsean17 avatar spenserschwartz avatar steven-nguyen-t avatar tavenshumaker avatar thisisscottcampbell avatar wangvwr avatar wi11chu avatar

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.