How to use the @rematch/core.init function in @rematch/core

To help you get started, we’ve selected a few @rematch/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zencrepes / zencrepes / stories / layout.js View on Github external
import { init } from "@rematch/core";

import HourglassEmptyIcon from '@material-ui/icons/HourglassEmpty';

import General from '../imports/ui/layouts/General/index.js';
import CustomCard from '../imports/ui/components/CustomCard/index.js';

import Terms from '../imports/ui/views/Terms/index.js';
import About from '../imports/ui/views/About/index.js';


// The *.mock.js files contains static redux stores configuration with no external dependencies (such as minimongo).
import * as models from "../imports/ui/services/models/index.mock.js";
//https://medium.com/ingenious/storybook-meets-redux-6ab09a5be346

const store = init({
    models
});

storiesOf('Layouts', module)
    .addDecorator(story => {story()})
    .addDecorator(story => {story()})
    .add('General', () => (
        <h4>General Content</h4>
    ))
    .add('Card', () =&gt; (
        }
            headerFactTitle="Completed this week"
            headerFactValue="9 Pts"
        &gt;
github zencrepes / zencrepes / stories / labels.js View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Provider } from 'react-redux';
import { init } from "@rematch/core";

import Actions from '../imports/ui/views/Sprints/Actions/index.js';

// The *.mock.js files contains static redux stores configuration with no external dependencies (such as minimongo).
import * as models from "../imports/ui/services/models/index.mock.js";
//https://medium.com/ingenious/storybook-meets-redux-6ab09a5be346

const store = init({
    models
});

storiesOf('Sprints', module)
    .addDecorator(story =&gt; {story()})
    .add('Action Bar', () =&gt; (
        
    ))
;
github zencrepes / zencrepes / client / main.js View on Github external
import * as models from "../imports/ui/services/models/index.js";

import App from "../imports/ui/App.js";

import { cfgIssues } from "../imports/ui/data/Minimongo.js";
import { cfgPullrequests } from "../imports/ui/data/Minimongo.js";
import { cfgSources } from "../imports/ui/data/Minimongo.js";
import { cfgQueries } from "../imports/ui/data/Minimongo.js";
import { cfgLabels } from "../imports/ui/data/Minimongo.js";
import { cfgMilestones } from "../imports/ui/data/Minimongo.js";
import { cfgProjects } from "../imports/ui/data/Minimongo.js";
import { cfgRepositories } from "../imports/ui/data/Minimongo.js";
import { cfgTeams } from "../imports/ui/data/Minimongo.js";

// generate Redux store
const store = init({
  models
});

//TODO - To be removed, for debugging
window.store = store;

Tracker.autorun(function() {
  if (Meteor.user()) {
    let username = Meteor.user().services.github.username;

    // Reload minimongo data from local storage
    const localCfgSources = new PersistentMinimongo2(
      cfgSources,
      "GAV-Repos-" + username
    );
    localCfgSources.refresh(true, () => {
github EvanBacon / Instagram / rematch / Gate.js View on Github external
import { AsyncStorage } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';

import * as models from './models';

const persistPlugin = createRematchPersist({
  // whiteList: ['user', 'onBoarding'],
  // blackList: ['users', 'hasMoreUsers', 'isLoadingUsers'],
  //   throttle: 5000,
  version: 3,
  storage: AsyncStorage,
});

const PERSIST_DATA = false;
export const store = init({
  models,
  plugins: [PERSIST_DATA &amp;&amp; persistPlugin],
});

global.__rematch_store = store;
global.__rematch_dispatch = store.dispatch;

class Gate extends React.Component {
  render() {
    const { children } = this.props;

    if (!PERSIST_DATA) {
      return {children};
    }
    return (
github zencrepes / zencrepes / stories / issues.js View on Github external
import { Provider } from 'react-redux';
import { init } from "@rematch/core";

import IssuesQuery from '../imports/ui/views/Issues/Query/index.js';
import Actions from '../imports/ui/views/Issues/Actions/index.js';

import TermFacet from '../imports/ui/views/Issues/Facets/Term/index.js';
import IssuesList from '../imports/ui/views/Issues/Content/IssuesList/index.js';
import Burndown from '../imports/ui/views/Issues/Content/Burndown/index.js';
import Velocity from '../imports/ui/views/Issues/Content/Velocity/index.js';

// The *.mock.js files contains static redux stores configuration with no external dependencies (such as minimongo).
import * as models from "../imports/ui/services/models/index.mock.js";
//https://medium.com/ingenious/storybook-meets-redux-6ab09a5be346

const store = init({
    models
});

/*
const query = JSON.parse("{\"repo.name\":{\"$in\":[\"ego\",\"enrolment\",\"score\"]},\"author.login\":{\"$in\":[\"lepsalex\"]},\"assignees.edges\":{\"$elemMatch\":{\"node.login\":{\"$in\":[\"lepsalex\",\"rtisma\"]}}}}");
const facets = JSON.parse("[{\"key\":\"repo.name\",\"name\":\"Repositories\",\"nested\":false,\"aggregations\":{}},{\"key\":\"org.name\",\"name\":\"Organizations\",\"nested\":false,\"aggregations\":{}},{\"key\":\"state\",\"name\":\"States\",\"nested\":false,\"aggregations\":{}},{\"key\":\"author.login\",\"name\":\"Authors\",\"nested\":false,\"aggregations\":{}},{\"key\":\"milestone.title\",\"name\":\"Milestones\",\"nullValue\":\"NO MILESTONE\",\"nullFilter\":{\"milestone\":{\"$eq\":null}},\"nested\":false,\"aggregations\":{}},{\"key\":\"milestone.state\",\"name\":\"Milestones States\",\"nested\":false,\"aggregations\":{}},{\"key\":\"assignees\",\"name\":\"Assignees\",\"nullValue\":\"UNASSIGNED\",\"nullFilter\":{\"assignees.totalCount\":{\"$eq\":0}},\"nested\":true,\"nestedKey\":\"login\",\"aggregations\":{}},{\"key\":\"labels\",\"name\":\"Labels\",\"nullValue\":\"NO LABEL\",\"nullFilter\":{\"labels.totalCount\":{\"$eq\":0}},\"nested\":true,\"nestedKey\":\"name\",\"aggregations\":{}}]");
const queries = JSON.parse("[{\"_id\":\"zZckgEve3mQ2Ems3X\",\"name\":\"HCMI\",\"filters\":\"{\\\"org.name\\\":{\\\"header\\\":\\\"Organizations\\\",\\\"group\\\":\\\"org.name\\\",\\\"type\\\":\\\"text\\\",\\\"nested\\\":false,\\\"in\\\":[\\\"Human Cancer Models Initiative - Catalog\\\"],\\\"nullSelected\\\":false}}\"},{\"_id\":\"eGHLjEnwQPCmfL6nf\",\"name\":\"Sprint 196\",\"filters\":\"{\\\"milestone.title\\\":{\\\"header\\\":\\\"Milestones\\\",\\\"group\\\":\\\"milestone.title\\\",\\\"type\\\":\\\"text\\\",\\\"nested\\\":false,\\\"nullName\\\":\\\"NO MILESTONE\\\",\\\"nullFilter\\\":{\\\"milestone\\\":{\\\"$eq\\\":null}},\\\"in\\\":[\\\"ARGO - Sprint 196\\\"],\\\"nullSelected\\\":false}}\"},{\"_id\":\"eXLRwr6GMy24xekY7\",\"name\":\"All (No filter)\",\"filters\":\"{}\"},{\"_id\":\"pXSPd7yweAAd9Rncf\",\"name\":\"Query Test\",\"filters\":\"{\\\"assignees\\\":{\\\"header\\\":\\\"Assignees\\\",\\\"group\\\":\\\"assignees\\\",\\\"type\\\":\\\"text\\\",\\\"nested\\\":\\\"login\\\",\\\"nullName\\\":\\\"UNASSIGNED\\\",\\\"nullFilter\\\":{\\\"assignees.totalCount\\\":{\\\"$eq\\\":0}},\\\"in\\\":[\\\"lepsalex\\\",\\\"hlminh2000\\\"],\\\"nullSelected\\\":false},\\\"milestone.state\\\":{\\\"header\\\":\\\"Milestones States\\\",\\\"group\\\":\\\"milestone.state\\\",\\\"type\\\":\\\"text\\\",\\\"nested\\\":false,\\\"in\\\":[\\\"OPEN\\\"],\\\"nullSelected\\\":false},\\\"org.name\\\":{\\\"header\\\":\\\"Organizations\\\",\\\"group\\\":\\\"org.name\\\",\\\"type\\\":\\\"text\\\",\\\"nested\\\":false,\\\"in\\\":[\\\"Human Cancer Models Initiative - Catalog\\\",\\\"Kids First Data Resource Center\\\"],\\\"nullSelected\\\":false}}\"},{\"_id\":\"EF43Hd9hdZPXtGrMC\",\"name\":\"New Name\",\"filters\":\"{}\"},{\"_id\":\"Bv69Mo2hrKpN6o66W\",\"name\":\"Ego\",\"filters\":\"{\\\"repo.name\\\":{\\\"$in\\\":[\\\"enrolment\\\",\\\"ego\\\"]}}\"},{\"_id\":\"T7GtapWTpP4PBdoXe\",\"name\":\"Ego-\",\"filters\":\"{\\\"repo.name\\\":{\\\"$in\\\":[\\\"ego\\\",\\\"enrolment\\\"]}}\"}]");
*/
const repoFacet = JSON.parse("{\"key\":\"repo.name\",\"name\":\"Repositories\",\"nested\":false,\"aggregations\":{},\"values\":[{\"name\":\"SONG\",\"count\":173,\"points\":73},{\"name\":\"arranger\",\"count\":143,\"points\":265},{\"name\":\"ego\",\"count\":78,\"points\":149},{\"name\":\"enrolment\",\"count\":69,\"points\":8},{\"name\":\"Jukebox\",\"count\":37,\"points\":1},{\"name\":\"score\",\"count\":30,\"points\":28},{\"name\":\"website\",\"count\":16,\"points\":0},{\"name\":\"persona\",\"count\":14,\"points\":33},{\"name\":\"roadmap\",\"count\":10,\"points\":8},{\"name\":\"ego-ui\",\"count\":6,\"points\":3},{\"name\":\"riff\",\"count\":5,\"points\":3},{\"name\":\"baton\",\"count\":3,\"points\":0},{\"name\":\"song-client\",\"count\":3,\"points\":5},{\"name\":\"rollcall\",\"count\":3,\"points\":3},{\"name\":\"microservice-template-java\",\"count\":2,\"points\":0},{\"name\":\"minime\",\"count\":1,\"points\":0},{\"name\":\"ego-token-middleware\",\"count\":1,\"points\":0},{\"name\":\"alter-ego\",\"count\":1,\"points\":0}]}");

storiesOf('Issues', module)
    .addDecorator(story =&gt; {story()})
    .add('Action Bar', () =&gt; (
        
    ))
    .add('Query', () =&gt; (
github rematch / rematch / plugins / updated / examples / count / src / index.js View on Github external
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { init } from '@rematch/core'
import createUpdatedPlugin from '@rematch/updated'
import App from './App'
import * as models from './models'

// create plugin
const updated = createUpdatedPlugin()

const store = init({
	models,
	plugins: [updated], // add to plugin list
})

ReactDOM.render(
	
		
	,
	document.getElementById('root')
)
github rematch / rematch / plugins / select / examples / cart / src / store.js View on Github external
import { init } from '@rematch/core'
import selectPlugin from '@rematch/select'
import * as models from './models'

export const store = init({
	models,
	plugins: [selectPlugin()],
})

export const { select } = store

export default store
github eveningkid / reacto / src / store / index.js View on Github external
/**
 * Allow information to be locally saved for next sessions.
 * More information about `redux-persist` configuration:
 * @see https://github.com/rt2zz/redux-persist/blob/master/docs/api.md#type-persistconfig
 */
const persistPlugin = createRematchPersist({
  whitelist: ['history', 'ui'],
});

/**
 * This project uses Rematch, built upon Redux.
 * If you're into Redux and don't like creating `actions` all the time,
 * give it a try. I really like it much more.
 * @see https://github.com/rematch/rematch
 */
export const store = init({
  models,
  plugins: [persistPlugin],
});
github shawjia / geektime-desktop / src / app / store / configureStore.js View on Github external
function configureStore() {
  return init({
    models: {
      setting,
      products,
      articles,
      article,
    },
    redux: {
      reducers: rootReducer,
      middlewares: [thunk, router]
    },
  });
}