How to use @rematch/core - 10 common examples

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 EvanBacon / Expo-Pillar-Valley / client / src / rematch / models.js View on Github external
compareDaily: async (props, { user }) => {
      const dailyVisits = await incrementDailyReward();

      if (dailyVisits !== user.dailyVisits) {
        // console.log('Yay! You came back, your streak is now at: ' + dailyVisits);

        dispatch.dailyStreak.set(dailyVisits);
        if (dailyVisits > user.dailyVisits) {
          dispatch.dailyStreak.rewardUser(dailyVisits);
        }
        dispatch.user.update({ dailyVisits });
        // / Give reward!
      } else {
        // console.log('ummmm', dailyVisits);
      }
    },
  },
github EvanBacon / pro-chat / client / src / rematch / auth.js View on Github external
authorized: (user) => {
      let _user = user;
      if (_user.toJSON) {
        _user = user.toJSON();
      }
      //   console.log('True User', _user);
      dispatch.user.update(_user);
    },
    logoutAsync: async () => {
github EvanBacon / pro-chat / client / src / rematch / user.js View on Github external
...nextFirebaseAuthData,
      };
      const updates = {};
      for (const key of Object.keys(combinedUserData)) {
        if (
          combinedUserData[key] !== undefined &&
          combinedUserData[key] !== nextLocalUserData[key]
        ) {
          updates[key] = combinedUserData[key];
        }
      }
      if (Object.keys(updates).length > 0) {
        dispatch.user.update(updates);
      }
      // dispatch.dailyStreak.compareDaily();
      dispatch.users.update({
        uid: combinedUserData.uid,
        user: combinedUserData,
      });
      console.log('Main:userdata:', combinedUserData);
      if (Settings.isCacheProfileUpdateActive) {
        const shouldUpdateKey = '@Bute/shouldUpdateProfile';
        const something = await PantryStorage.getItemWithExpiration(shouldUpdateKey);
        if (!something) {
          const some = await PantryStorage.setItemWithExpiration(
            shouldUpdateKey,
            { update: true },
            Settings.shouldDelayFirebaseProfileSyncInMinutes,
          );
          dispatch.user.syncLocalToFirebase();
        } else {
          console.log('Prevent: syncLocalToFirebase');
github EvanBacon / pro-chat / client / src / rematch / chats.js View on Github external
// TODO: Nope...
      const user = await new Promise(res =&gt;
        dispatch.users.ensureUserIsLoadedAsync({ uid, callback: res }));
      console.log('_parseMessage: has user', !!user, uid);
      //   const user = await Fire.shared.getUserAsync({ uid });
      if (user == null) {
        throw new Error("Invalid User data found, can't parse message");
      }
      console.log('Add Message', message.key);

      const messages = {
        ...chats[groupId],
        [message.key]: transformMessageForGiftedChat({ message, user }),
      };

      dispatch.chats.addMessages({
        groupId,
        messages,
      });

      // / UGH

      const sortedMessages = Object.values(messages).sort((a, b) =&gt; a.timestamp &lt; b.timestamp);
      dispatch.messages.updateWithMessage({
        groupId,
        message: sortedMessages[0],
      });
    },
    startChatting: async ({ uids, callback, groupId }, { chats }) =&gt; {