brijeshb42 / medium-draft

📝 A medium like Rich Text Editor built on draft-js with a focus on keyboard shortcuts.
https://bitwiser.in/medium-draft/
MIT License
1.73k stars 245 forks source link

My app crash #222

Open baxa29102001 opened 3 years ago

baxa29102001 commented 3 years ago

Hi I am new for medium draft i have issue getIn of undefined

Warning

react-dom.development.js:67 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.

Please update the following components: Toolbar printWarning @ react-dom.development.js:67 warn @ react-dom.development.js:34 push../node_modules/react-dom/cjs/react-dom.development.js.ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings @ react-dom.development.js:11530 flushRenderPhaseStrictModeWarningsInDEV @ react-dom.development.js:23822 commitRootImpl @ react-dom.development.js:23005 unstable_runWithPriority @ scheduler.development.js:468 runWithPriority$1 @ react-dom.development.js:11276 commitRoot @ react-dom.development.js:22990 performSyncWorkOnRoot @ react-dom.development.js:22329 scheduleUpdateOnFiber @ react-dom.development.js:21881 updateContainer @ react-dom.development.js:25482 (anonymous) @ react-dom.development.js:26021 unbatchedUpdates @ react-dom.development.js:22431 legacyRenderSubtreeIntoContainer @ react-dom.development.js:26020 hydrate @ react-dom.development.js:26086 renderReactElement @ index.tsx:524 doRender @ index.tsx:793 _callee2$ @ index.tsx:425 tryCatch @ runtime.js:63 invoke @ runtime.js:293 (anonymous) @ runtime.js:118 asyncGeneratorStep @ asyncToGenerator.js:3 _next @ asyncToGenerator.js:25 (anonymous) @ asyncToGenerator.js:32 (anonymous) @ asyncToGenerator.js:21 _render @ main.js?ts=1623828649621:9084 render @ main.js?ts=1623828649621:9021 (anonymous) @ next-dev.js:85 (anonymous) @ fouc.js:14 requestAnimationFrame (async) displayContent @ fouc.js:5 (anonymous) @ next-dev.js:84 Promise.then (async) ./node_modules/next/dist/client/next-dev.js @ next-dev.js:31 options.factory @ react refresh:8 webpack_require @ bootstrap:25 webpack_exec @ main.js?ts=1623828649621:47319 (anonymous) @ main.js?ts=1623828649621:47320 webpackJsonpCallback @ jsonp chunk loading:559 (anonymous) @ main.js?ts=1623828649621:1 react-dom.development.js:67 Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.

Please update the following components: DraftEditor

Prop id did not match. Server: "placeholder-33j6k" Client: "placeholder-3q0mk" at div at div at DraftEditorPlaceholder (http://localhost:3000/_next/static/chunks/pages/new-story.js?ts=1623828649621:10037:5) at div at DraftEditor (http://localhost:3000/_next/static/chunks/pages/new-story.js?ts=1623828649621:8546:5) at div at div at MediumDraftEditor (http://localhost:3000/_next/static/chunks/pages/new-story.js?ts=1623828649621:34055:5) at div at NewStory (http://localhost:3000/_next/static/chunks/pages/new-story.js?ts=1623828649621:215:64) at Story at Provider (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1623828649621:3000:20) at MyApp (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1623828649621:172:24) at ErrorBoundary (http://localhost:3000/_next/static/chunks/main.js?ts=1623828649621:742:47) at ReactDevOverlay (http://localhost:3000/_next/static/chunks/main.js?ts=1623828649621:858:23) at Container (http://localhost:3000/_next/static/chunks/main.js?ts=1623828649621:8719:5) at AppContainer (http://localhost:3000/_next/static/chunks/main.js?ts=1623828649621:9207:24) at Root (http://localhost:3000/_next/static/chunks/main.js?ts=1623828649621:9343:25)

getUpdatedSelectionState.js:33 Uncaught TypeError: Cannot read property 'getIn' of undefined at getUpdatedSelectionState (getUpdatedSelectionState.js:33) at getDraftEditorSelectionWithNodes (getDraftEditorSelectionWithNodes.js:88) at getDraftEditorSelection (getDraftEditorSelection.js:33) at editOnSelect (editOnSelect.js:31) at DraftEditor.react.js:216 at HTMLUnknownElement.callCallback (react-dom.development.js:3945) at Object.invokeGuardedCallbackDev (react-dom.development.js:3994) at invokeGuardedCallback (react-dom.development.js:4056) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070) at executeDispatch (react-dom.development.js:8243) at processDispatchQueueItemsInOrder (react-dom.development.js:8275) at processDispatchQueue (react-dom.development.js:8288) at dispatchEventsForPlugins (react-dom.development.js:8299) at react-dom.development.js:8508 at batchedEventUpdates$1 (react-dom.development.js:22396) at batchedEventUpdates (react-dom.development.js:3745) at dispatchEventForPluginEventSystem (react-dom.development.js:8507) at attemptToDispatchEvent (react-dom.development.js:6005) at dispatchEvent (react-dom.development.js:5924) at unstable_runWithPriority (scheduler.development.js:468) at runWithPriority$1 (react-dom.development.js:11276) at discreteUpdates$1 (react-dom.development.js:22413) at discreteUpdates (react-dom.development.js:3756) at dispatchDiscreteEvent (react-dom.development.js:5889)

brijeshb42 commented 3 years ago

You should not try to render the editor on server. Instead, lazy load it in browser using dynamic import and render it on client.

baxa29102001 commented 3 years ago

You should not try to render the editor on server. Instead, lazy load it in browser using dynamic import and render it on client.

Yeah it is working but editoRef.current.focus() isnt working

TypeError: refsEditor.current.focus is not a function

brijeshb42 commented 3 years ago

Can you paste a snippet, specifically how the refsEditor is being assigned ?