Skip to content

Commit

Permalink
fix: only fire warnings during development
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Apr 4, 2020
1 parent adca16f commit 239edda
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/glaze/src/StyleInjector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Based on:

import React from 'react';

import { canUseDOM } from './env';
import { canUseDOM, isDev } from './env';
import { warnOnce } from './logger';

const MAX_RULE_COUNT = 0xffff;
Expand Down Expand Up @@ -107,11 +107,13 @@ export class NullStyleInjector implements StyleInjector {

// eslint-disable-next-line class-methods-use-this
addRule(): number {
// TODO: Add instructions for resolving the situation
if (canUseDOM) {
warnOnce('Client-side rendering of dynamic styles is not set up');
} else {
warnOnce('Server-side rendering of dynamic styles is not set up');
if (isDev) {
// TODO: Add instructions for resolving the situation
if (canUseDOM) {
warnOnce('Client-side rendering of dynamic styles is not set up');
} else {
warnOnce('Server-side rendering of dynamic styles is not set up');
}
}

return 0;
Expand Down

0 comments on commit 239edda

Please sign in to comment.