Skip to content

Commit

Permalink
DEP Update code to work with upgraded deps
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 8, 2022
1 parent 278d185 commit c1eac5d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions client/src/bundles/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

// Expose fields (see webpack config for matching "externals" config)
require('expose-loader?HistoryViewer!components/HistoryViewer/HistoryViewer');
require('expose-loader?exposes=HistoryViewer!components/HistoryViewer/HistoryViewer');

require('expose-loader?versionType!types/versionType');
require('expose-loader?exposes=versionType!types/versionType');

// Legacy CMS
require('../legacy/ArchiveAdmin/ArchiveAdmin');
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/HistoryViewer/HistoryViewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $diff-added-color: #b9f1c8;
}

// Hide preview on small devices. @todo replace this with a view toggle component
@include media-breakpoint-down(md) {
@include media-breakpoint-down(lg) {
.history-viewer__preview {
display: none;
}
Expand Down
16 changes: 11 additions & 5 deletions client/src/legacy/HistoryViewer/HistoryViewerEntwine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import jQuery from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { loadComponent } from 'lib/Injector';

/**
Expand All @@ -9,6 +10,8 @@ import { loadComponent } from 'lib/Injector';
*/
jQuery.entwine('ss', ($) => {
$('.js-injector-boot .history-viewer__container').entwine({
ReactRoot: null,

onmatch() {
const cmsContent = this.closest('.cms-content').attr('id');
const context = (cmsContent)
Expand All @@ -25,14 +28,17 @@ jQuery.entwine('ss', ($) => {
isInGridField: schemaData.data.isInGridField || !this.hasClass('history-viewer--standalone'),
};

ReactDOM.render(
<HistoryViewerComponent {...props} />,
this[0]
);
const root = createRoot(this[0]);
root.render(<HistoryViewerComponent {...props} />);
this.setReactRoot(root);
},

onunmatch() {
ReactDOM.unmountComponentAtNode(this[0]);
const root = this.getReactRoot();
if (root) {
root.unmount();
this.setReactRoot(null);
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion client/src/state/historyviewer/HistoryViewerActions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { v1 as uuidv1 } from 'uuid';
import HISTORY_VIEWER from './HistoryViewerActionTypes';
import uuidv1 from 'uuid/v1';

/**
* Setting the current version will enable context views for a specific record
Expand Down

0 comments on commit c1eac5d

Please sign in to comment.