File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
assets/js/phoenix_live_view Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import OriginalLiveSocket, { isUsedInput } from "./live_socket";
1010import DOM from "./dom" ;
1111import { ViewHook } from "./view_hook" ;
1212import View from "./view" ;
13+ import { logError } from "./utils" ;
1314
1415import type { LiveSocketJSCommands } from "./js_commands" ;
1516import type { Hook , HooksOptions } from "./view_hook" ;
@@ -329,6 +330,13 @@ function createHook(el: HTMLElement, callbacks: Hook): ViewHook {
329330 return existingHook ;
330331 }
331332
333+ if ( ! el . hasAttribute ( "id" ) ) {
334+ logError (
335+ "Elements passed to createHook need to have a unique id attribute" ,
336+ el ,
337+ ) ;
338+ }
339+
332340 let hook = new ViewHook ( View . closestView ( el ) , el , callbacks ) ;
333341 DOM . putCustomElHook ( el , hook ) ;
334342 return hook ;
You can’t perform that action at this time.
0 commit comments