This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import PropTypes from 'prop-types' | |
import { kea } from 'kea' | |
import { put, call } from 'redux-saga/effects' | |
import { delay } from 'redux-saga' | |
const API_URL = 'https://api.github.com' | |
@kea({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// features-logic.js | |
import PropTypes from 'prop-types' | |
import { kea } from 'kea' | |
export default kea({ | |
actions: () => ({ | |
toggleFeature: (feature) => ({ feature }) | |
}), | |
reducers: ({ actions }) => ({ | |
features: [{}, PropTypes.object, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… actionpack-5.2.0/lib/action_dispatch/routing/route_set.rb:92:in `ActionDispatch::Routing::RouteSet::NamedRouteCollection#clear!' (99 samples - 6.40%) (2 exclusive - 0.13%) | |
/Users/marius/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/set.rb:336:in `Set#each' (118 samples - 7.63%) | |
… actionpack-5.2.0/lib/action_dispatch/routing/route_set.rb:92:in `ActionDispatch::Routing::RouteSet::NamedRouteCollection#clear!' (99 samples - 6.40%) | |
… actionpack-5.2.0/lib/action_dispatch/routing/route_set.rb:443:in `ActionDispatch::Routing::RouteSet#clear!' (100 samples - 6.47%) | |
… railties-5.2.0/lib/rails/application/routes_reloader.rb:49:in `Rails::Application::RoutesReloader#clear!' (100 samples - 6.47%) | |
… railties-5.2.0/lib/rails/application/routes_reloader.rb:49:in `Rails::Application::RoutesReloader#clear!' (100 samples - 6.47%) | |
… railties-5.2.0/lib/rails/application/routes_reloader.rb:18:in `Rails::Application::RoutesReloader#reload!' (1004 samples - 64.94%) | |
… railties-5.2.0/lib/rails/application/routes_reloader.rb:41:in `Rails::Ap |
This is a draft of an issue I intend to post on the rails/rails repo.
Update: the issue is posted
Hello,
TL;DR; My fairly large Rails app (173 models, 208 controllers) is suffering from a continuously increasing slowdown that makes it hard to work on it. Each reload of the code takes longer than the previous one, with delays increasing to minutes after just a few reloads. I have identified a cause and it's also present on new apps (rails new leaky
). No solution yet.
For the past years I've been coping with an issue that Rails feels extremely slow when developing. I start the server, wait for it to boot up and open the site. It takes a minute or two before it loads.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Plugin to make preloaded state work with kea 1.0 | |
// (pseudocode, not tested, use ) | |
{ | |
name: 'preloadedState', | |
buildSteps: { | |
defaults (logic, input) { | |
const node = getContext().options.preloadedState | |
if (node) { | |
// find preLoadedState.[path[0]].[path[1]].etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import { getContext } from 'kea' | |
function Connections ({ logic }) { | |
if (Object.keys(logic.connections).length === 1) { | |
return null | |
} | |
return ( | |
<div style={{ marginTop: 10 }}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Auto-generated with kea-typegen. DO NOT EDIT! | |
export interface githubLogicType<Repository> { | |
key: undefined | |
actionCreators: { | |
setUsername: ( | |
username: string, | |
) => { | |
type: 'set username (samples.githubLogic)' | |
payload: { username: string } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a crude implementation of a graphql plugin for kea. | |
// It needs to be cleaned up, tested and then made into a real plugin. | |
// There is basic support for subscriptions and reloading. | |
// Mutations are not implemented | |
// To use: | |
// - logicWithGraphQL.values.course == { id: 123, { translations: [...] } } | |
// - logicWithGraphQL.values.courseVariables == { id: 123 } | |
import gql from 'graphql-tag' | |
import { kea } from 'kea' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { setPluginContext, getPluginContext, useMountedLogic } from 'kea' | |
import { useEffect } from 'react' | |
/* | |
usage: | |
kea({ | |
dimensions: { | |
// key: [defaultValue, calcFunction], | |
isSmallScreen: [false, window => window.innerWidth < 640], |
OlderNewer