Skip to content

Fix strict mode bugs #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions development/App.js

This file was deleted.

17 changes: 17 additions & 0 deletions development/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './index.scss';
import './../src/styles/index.scss';
import React from 'react';
import {Provider} from 'react-redux';
import ReduxToastr from '../src';
import Menu from './Menu';

export default function App(props) {
return (
<Provider store={props.store}>
<div className="wrapper">
<ReduxToastr preventDuplicates position="bottom-left"/>
<Menu />
</div>
</Provider>
);
}
File renamed without changes.
2 changes: 1 addition & 1 deletion development/Menu.js → development/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {toastr} from './../src/';
import {toastr} from '../src';
import loremIpsum from 'lorem-ipsum';
import Avatar from './Avatar';
import messageText from './messageText';
Expand Down
4 changes: 3 additions & 1 deletion development/client.js → development/client.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
import React from 'react';
import React, {StrictMode} from 'react';
import createStore from './store';
import App from './App';
import ReactDOM from "react-dom/client";
Expand All @@ -8,5 +8,7 @@ const store = createStore();
const root = ReactDOM.createRoot(document.getElementById("app"));

root.render(
<StrictMode>
<App store={store} />
</StrictMode>
);
9 changes: 0 additions & 9 deletions src/ReduxToastr.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export class ReduxToastr extends React.Component {
}
};

toastrFired = {};

toastrPositions = [
'top-left',
'top-right',
Expand Down Expand Up @@ -72,11 +70,6 @@ export class ReduxToastr extends React.Component {
EE.removeListener('clean/toastr');
EE.removeListener('removeByType/toastr');
EE.removeListener('remove/toastr');
this.toastrFired = {};
}

_addToMemory(id) {
this.toastrFired[id] = true;
}

_renderToastrForPosition(position) {
Expand All @@ -100,8 +93,6 @@ export class ReduxToastr extends React.Component {
return (
<div key={item.id}>
<ToastrBox
inMemory={this.toastrFired}
addToMemory={() => this._addToMemory(item.id)}
item={mergedItem}
{...this.props}
/>
Expand Down
3 changes: 0 additions & 3 deletions src/ToastrBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export default class ToastrBox extends React.Component {

componentDidMount() {
const {item} = this.props;
if (this.props.inMemory[item.id]) return;

const timeOut = this._getItemTimeOut();

if (timeOut) {
Expand All @@ -76,7 +74,6 @@ export default class ToastrBox extends React.Component {
if (this.toastrBoxElement) {
this.toastrBoxElement.addEventListener('transitionend', this._onAnimationComplete);
}
this.props.addToMemory(item.id);

if (this.closeButton !== undefined && !item.options.disableCloseButtonFocus) {
this.closeButton.focus();
Expand Down
2 changes: 1 addition & 1 deletion webpack/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const config = require('../config');
module.exports = {
target: 'web',
entry: {
app: path.join(config.path_base, '/' + config.dir_client + '/client.js')
app: path.join(config.path_base, '/' + config.dir_client + '/client.jsx')
},
output: {
path: path.join(config.path_base + '/dist'),
Expand Down
2 changes: 1 addition & 1 deletion webpack/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'
baseConfig.entry.app = [
`webpack-dev-server/client?http://localhost:${config.server_port}`,
'webpack/hot/only-dev-server',
`${config.path_base}/${config.dir_client}/client.js`
`${config.path_base}/${config.dir_client}/client.jsx`
];

baseConfig.devtool = 'inline-source-map';
Expand Down