create-interview-cockpit 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-interview-cockpit",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Scaffold a personal AI-powered interview prep cockpit",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,8 @@ export default function App() {
10
10
  const {
11
11
  fetchTopics,
12
12
  fetchWorkspaces,
13
+ fetchQuestions,
14
+ selectQuestion,
13
15
  currentQuestion,
14
16
  showCodePanel,
15
17
  toggleCodePanel,
@@ -23,6 +25,24 @@ export default function App() {
23
25
  const init = async () => {
24
26
  await fetchWorkspaces();
25
27
  await fetchTopics();
28
+ // Restore last-viewed question after page refresh
29
+ const topicId = sessionStorage.getItem("lastTopicId");
30
+ const questionId = sessionStorage.getItem("lastQuestionId");
31
+ if (topicId && questionId) {
32
+ try {
33
+ await fetchQuestions(topicId);
34
+ await selectQuestion(topicId, questionId);
35
+ // Expand the topic so it's visible in the sidebar
36
+ const { expandedTopics } = useStore.getState();
37
+ if (!expandedTopics.includes(topicId)) {
38
+ useStore.getState().toggleTopic(topicId);
39
+ }
40
+ } catch {
41
+ // Question may no longer exist — ignore
42
+ sessionStorage.removeItem("lastTopicId");
43
+ sessionStorage.removeItem("lastQuestionId");
44
+ }
45
+ }
26
46
  };
27
47
  init();
28
48
  }, []);
@@ -362,6 +362,8 @@ export const useStore = create<Store>((set, get) => ({
362
362
  currentQuestion: question,
363
363
  codeSnippets: [],
364
364
  });
365
+ sessionStorage.setItem("lastTopicId", topicId);
366
+ sessionStorage.setItem("lastQuestionId", questionId);
365
367
  },
366
368
 
367
369
  addSnippet: (snippet) =>