console-feed icon indicating copy to clipboard operation
console-feed copied to clipboard

Reverse log display order possible?

Open TenaciousTechnologistExtraordinaire opened this issue 2 years ago • 1 comments

Hello, I have your plugin partially working, but I have to increase my y resolution to ludicrous 32,000 pixels so I can scroll all the way down to the bottom to see the latest log entries. Is there a way to reverse the order of the log entries so that the newest logs show on top instead of at the bottom:

`import React, { useState, useEffect } from 'react' import { Console, Hook, Unhook } from 'console-feed' import * as Demo from "./demo";

const LogsContainer = () => { const [logs, setLogs] = useState([]) // run once! useEffect(() => { Hook( window.console, (log) => setLogs((currLogs) => [...currLogs, log]), false )

return () => Unhook(window.console)

}, [])

return <Console logs={logs} variant="dark" /> }

export default LogsContainer`

Maybe it's too long after, but this seems pretty straightforward.
Just change

(log) => setLogs((currLogs) => [...currLogs, log]),

to

(log) => setLogs((currLogs) => [log, ...currLogs]),

implicit-invocation avatar Oct 11 '23 18:10 implicit-invocation